Hi venderkerkoff, I made 2 examples for you, the first using Javascript and the other using Jquery: 1- Javascript Just create radio buttons group named "group1" and give each button a value contains (the url of the new action of the form), then click on the button (CLICK ME) to call the function (setNewAction) and give it the radio group (as object), after that the function will work on the radio group to get the ckecked option and set the new form action to the value of that radio button, then the form will be submitted due to last statement in the function (document.forms[0].submit();). ===================================================================================== <html> <head> <script language="javascript"> function setNewAction(radioGroupObj) { for(var i = 0 ; i < radioGroupObj.length ; i++) { if(radioGroupObj[i].checked) { document.forms[0].action = radioGroupObj[i].value; } } document.forms[0].submit(); } </script> </head>
<form name="form1" id="my_form" method="get" action="test.html"> <p> <label> <input type="radio" name="group1" value="page1.php"> Form Action Page 1</label> <br> <label> <input type="radio" name="group1" value="page2.aspx"> Form Action Page 2</label> <br> </p> <input type="button" id="butt" value="CLICK ME" onClick="setNewAction(this.form.group1)"> </form> <body> </body> </ht ml> ======================================================================================= 2- JQuery create radio buttons group named "group1" and give each button a value contains (the url of the new action of the form), then using $(document).ready functions, which runs when the document completely loaded, assign a (click) function to the (group1) using the JQuery selector $("[EMAIL PROTECTED]'group1']") which means to get any (input) with name of (group1), inside the click function you can see the code $("#my_form").attr("action",$(this).val()); it selectes the form by its id (my_form) then change the attribute action of the form to the value of the selected radion button using attr("action", $(this).val()), where $(this) refers to the current clicked radio and val() is a function that reutrn the value. ======================================================================================= <html> <head> <script src="jquery.js"></script> <script language="javascript"> $(document).ready ( function() { $("[EMAIL PROTECTED]'group1']").click ( function() { $("#my_form").attr("action",$(this).val()); } ); } ); </script> </head> <form name="form1" id="my_form" method="get" action="test.html"> <p> <label> <input type="radio" name="group1" value="page1.php"> Form Action Page 1</label> <br> <label> <input type="radio" name="group1" value="page2.aspx"> Form Action Page 2</label> <br> </p> <input type="submit" value="Submit"> </form> <body> </body> </html> ============================================================================== You can find a good Javascript reference here http://www.javascriptkit.com/jsref/ And for JQuery, you can take a look at http://docs.jquery.com And concentrate on this, to get a good vision about the JQuery Selectors http://docs.jquery.com/Selectors Thanks. Qutoz, On Fri, Apr 4, 2008 at 11:22 AM, vanderkerkoff <[EMAIL PROTECTED]> wrote: > > Hello everyone > > First post, please be gentle > > I need to have a search form that sends the variable to search to one > of two places based on whether or not someone clicks a radio button. > > It's like tick here to only search for courses button in a search from > on a website. > > The two searches are in different places, different technologies, so I > need to change form variables based on the radio button being selected > or not. > > Can anyone point me in the right direction of how to do this with > jquery? I have no experience of JS or JQuery so it looks a bit > daunting at the moment. > > Any help, greatly appreciated. >