Jump to content

Having a form submit to a different place depending on a variable..


rottenpixies

Recommended Posts

I am trying to have a form submit to another source depending on a certain variable. Only problem is that the variable is not defined untill after you submit the form. Basically if a certain text field in the form is left blank i want it to be posting to a different place.

 

Why cannot you do something like this:

 


<form id="MyForm" onsubmit="javascript: if(document.getElementById('Element').value='something'){ document.getElementById('MyForm').action='SomeAction.php'; }">

 

I have used similar code several times :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.