views:

23

answers:

2

Need the three "Options" to be hyperlinks that submit the "choice" form. When submitted, I would like the value to be the text of the option selected (i.e. value=Option1, Option2 orOption3) and all three to have the same name. (i.e. name = Options)

I saw this and some other posts here, but did not work with my set up - many "hyperlink inputs" within the form.

I'm also using JQuery now, if it can be done using that library, I saw some posts on their forum about this but not sure about the answers....

Any help is appreciated.

<form action="cgi.exe" method=POST name="choice">  
     <tbody>                    
         <tr>                    
           <td>Option1</td>
           <td>Option2</td>
           <td>Option3</td>
         </tr>
    </tbody> 
</form>
+1  A: 

You'd attach a click event to the item that then submits the form:

$('yourItem').click(function(){$('yourForm').submit()})

However, you don't really have a form there. Either you'd want those to be proper form INPUT elements or perhaps you need to use some sort of AJAX call instead.

DA
That's the thing, I don't want them to be proper form elements. Just a pure hyperlink (or at least displayed that way) No radio, text, or check, etc...
Tommy
But if there is no form elements, then no data is being sent via the form submission.
DA
+2  A: 

You could just apply styles to your submit button to make it look like a link and avoid javascript altogether.

<input type="submit" style="background-color: #fff; border: 0; text-decoration: underline; color: #00c;" name="submit" value="Option1">

Otherwise, start here for help:

http://www.javascript-coder.com/javascript-form/javascript-form-submit-example.html

ghoppe
This works, thank you.
Tommy