I have a form that I am using as a wizard. The wizard comprises of
several forms contained in divs, which are hidden/made visible,
depending on the wizard step. Each form has an action parameter set to a
different php script, which is responsible for returning a true/false (+
mesage back to the form.
So I have something like this:
<div id = "page1"><fo rm onaction = "step1.php"
method="post">. ..</form></div>
<div id = "page2"><fo rm onaction = "step2.php"
method="post">. ..</form></div>
I know how to set the onclick event of the button in a form to a
javascript function - so I can validate the form input before sending
the data to the server. However, this is what I want to do (in
pesudocode below):
if (form_is_valid( formId))
{
//Send form input data to php server script
//get server response from php script and display in alert box
}
I don't know if its possible to cause a php script to be run by
"calling" it from JS (ala RPC), but basically, what I want to do is:
a). Validata user input clientside, using JS (easy bit)
b). Cause the form to invoke its action method (How?)
c). Receive server response in JS and display in alert box (HOW?)
several forms contained in divs, which are hidden/made visible,
depending on the wizard step. Each form has an action parameter set to a
different php script, which is responsible for returning a true/false (+
mesage back to the form.
So I have something like this:
<div id = "page1"><fo rm onaction = "step1.php"
method="post">. ..</form></div>
<div id = "page2"><fo rm onaction = "step2.php"
method="post">. ..</form></div>
I know how to set the onclick event of the button in a form to a
javascript function - so I can validate the form input before sending
the data to the server. However, this is what I want to do (in
pesudocode below):
if (form_is_valid( formId))
{
//Send form input data to php server script
//get server response from php script and display in alert box
}
I don't know if its possible to cause a php script to be run by
"calling" it from JS (ala RPC), but basically, what I want to do is:
a). Validata user input clientside, using JS (easy bit)
b). Cause the form to invoke its action method (How?)
c). Receive server response in JS and display in alert box (HOW?)
Comment