q1234ask Posted March 27, 2006 Share Posted March 27, 2006 Hey,I need to change the form action to different page according to the selinsutype dropdown selection.I have the javascript code but it does not work. it goes no where.What is wrong? Please advise. Thanks!!!javascript code here:function submitCurrentForm(){ form=document.form1; var alertmsg=''; var mstr="Please correct the following fields to continue:"; if (form.elements['txtfdate'].value=='') { alertmsg+="\nFrom Date"; } if (form.elements['txttodate'].value=='') { alertmsg+="\nTo Date"; } var selected_index=form.selinsutype.selectedIndex; var insutype=form.selinsutype[selected_index].text; if(insutype=="MEDICARE") form.Action="revenueoutput.php"; if(insutype=="MEDICAID") form.Action="medicaidrevenue.php"; if(insutype="PRIVATE") form.Action="privatepaidrpt.php"; if(alertmsg.length>4) { mstr+=alertmsg; alert (mstr); }else {form1.submit();}} Link to comment https://forums.phpfreaks.com/topic/5972-how-to-use-javascript-to-change-form-action/ Share on other sites More sharing options...
kenrbnsn Posted March 28, 2006 Share Posted March 28, 2006 This is the PHP forum, please post your Javascript questions in the Javascript forum.Ken Link to comment https://forums.phpfreaks.com/topic/5972-how-to-use-javascript-to-change-form-action/#findComment-21417 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.