Issue
I'm not sure if this is even possible with some kind of hack, but maybe somebody knows how to achieve to combine multiple <button>
s or even better <input type="submit">
fields with <input type="radio">
. In the end I want to transform the following code:
<form method="post" action="/process">
<input type="radio" name="item" value="item 1">
<input type="radio" name="item" value="item 2">
<input type="submit" value="Submit">
</form>
in something like this:
<form method="post" action="/process">
<input type="submit" value="Submit Item 1">
<input type="radio" name="item" value="item 1"/>
</input>
<input type="submit" value="Submit Item 2">
<input type="radio" name="item" value="item 2"/>
</input>
</form>
or maybe something like that:
<form method="post" action="/process">
<button>
<input type="radio" name="item" value="item 1">
</button>
<button>
<input type="radio" name="item" value="item 2">
</button>
</form>
The goal is to have one form with multiple send-buttons, while the information which button was pressed gets also passed to the server.
Is there any chance to get this done without JavaScript?
Solution
You could use something like this to solve your problem:
<form method="post" action="/process">
<button type="submit" name="item" value="item 1">
Option 1
</button>
<button type="submit" name="item" value="item 2">
Option 2
</button>
</form>
Answered By - Jerem
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.