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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF ELSE question 4

Status
Not open for further replies.
Jun 9, 2004
188
US
Hello I really do not know much javascript so I wont beat around the bush. I am trying to change a forms action based on radio buttons that the users selects.

For example:
Radio 1 is selected the action would be search.asp
If radio2 is selected then action would be searchsite.asp

Is this possible with javascript?

Can anyone show me an example that I can tweak.

This is what I have so far:
Code:
<form action="+ need to change this value +" method="post" name="entry" >
	<input type="text" name="search_value" size="26"> <br>
	<input type="radio" name="group1" value="radio1" checked>
    <font size="1" face="Verdana, Arial, Helvetica, sans-serif">Radio 1</font> 
    <input type="radio" name="group1" value="radio2">
    <font size="1" face="Verdana, Arial, Helvetica, sans-serif">Radio2</font> 
    <input type="submit">
</form>
Code:
script language="JavaScript">

  
      if (form == radio1)
       {
         document.writeln("do something");
       }
      else
       {
         document.writeln("do something");
       }  
   ; 
  // end hiding code -->
</script>
i have no clue on what is going on but I thought it might be worth a try.
 

Code:
<form name="entry" onsubmit="[red]return [/red]subForm();" target="_blank">

You need to return the return value that was sent from the function to the event. This way, if the function finds a problem with the data, it can tell the submit event to not submit the form.

I assume this is what you are looking for?

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
Any time.

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top