Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with multiple Forms

Status
Not open for further replies.

Markh51

Programmer
May 20, 2003
81
0
0
GB
How do I get the following code to work ?

<INPUT TYPE=&quot;radio&quot; NAME=&quot;ID&quot; VALUE=&quot;1&quot;>Option 1
<INPUT TYPE=&quot;radio&quot; NAME=&quot;ID&quot; VALUE=&quot;2&quot;>Option 2

<FORM METHOD=&quot;POST&quot;><INPUT TYPE=&quot;submit&quot; NAME=&quot;b1&quot; VALUE=&quot;1&quot;></FORM>
<FORM METHOD=&quot;POST&quot;><INPUT TYPE=&quot;submit&quot; NAME=&quot;b2&quot; VALUE=&quot;2&quot;></FORM>
<FORM METHOD=&quot;POST&quot;><INPUT TYPE=&quot;submit&quot; NAME=&quot;b3&quot; VALUE=&quot;3&quot;></FORM>

What happens is when the user clicks one of the submit buttons, it only sends the value of that button. I need it to also send the value of whatever radio button is clicked. I need to have the buttons set in different Forms as they are going to have different actions. I have tried &quot;grouping&quot; the forms with another form, but no joy !

I need to try and do this without using JS.

Cheers.
 
Thanks, for that...

But I know I can use JS to perform waht I want, but I need to steer clear of JS, as it is easy to disable.

Regards.
 
Then why not use one script to do all three actions? You can tell which SUBMIT button has been pressed from the POST/GET values... see the example below. This uses GET so the results will be added to the query string.

In your server-side code, just check which button (B1, B2 or B3) is present in the request object:

Code:
<html>
<head>
	<title>GET Example</title>
</head>
<body>
<FORM action=&quot;&quot; METHOD=&quot;get&quot;>
	<INPUT TYPE=&quot;radio&quot; NAME=&quot;ID&quot; VALUE=&quot;1&quot;>Option 1
	<INPUT TYPE=&quot;radio&quot; NAME=&quot;ID&quot; VALUE=&quot;2&quot;>Option 2
	<INPUT TYPE=&quot;submit&quot; NAME=&quot;b1&quot; VALUE=&quot;Go Here&quot;>
	<INPUT TYPE=&quot;submit&quot; NAME=&quot;b2&quot; VALUE=&quot;Go There&quot;>
	<INPUT TYPE=&quot;submit&quot; NAME=&quot;b3&quot; VALUE=&quot;Go Everywhere&quot;>
</FORM>
</body>
</html>

You can even set all 3 SUBMIT buttons to the same name, since they will all have different values (I assume).

Pete.


Lotus Notes Web Developer / Aptrix (LWWCM) Consultant
w: e: Pete.Raleigh(at)lclimited.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top