Author |
Topic |
|
Testa
Expert
Italy
74 Posts |
Posted - 02 Apr 2009 : 13:57:08
|
Hi, i've a problem with a form that i want send via mail. The form contains 1 layer visible and 2 layers not visible, switchable between them, with only one active. Every layer is inside the form recipient and contains some required field evaluate from a function call.
- When i call the function that check required fields, i have different situation depending on browser used.
With Mozilla browser all work well: - all fields in all layers (also not visible) are evaluate and the form is sent only if all required fields are ok. With IE after the message of "required field missing" in the non-visible layer, the form is sent always.
Anyone can help me? I'd like that IE make the same situation of the Mozilla browser.
- Besides in the field action of the form proprieties write "Send_Form.php" wich is the server side script for send the form. This script work well, but when sent form (by clicking "send" button) all browser load a blanck page named Send_Form.php.
How can i make that browser don't open php page?
Thanks. Regards, Stefano.[2 ??:-|] |
My Google+ profile: https://plus.google.com/i/zw25-_gKvTY:jRss3zGURdE
Web sites made in DHTML:
http://terapiabrevestrategica-emilia.it/ http://papaveriepapere-ravenna.com/ http://mp-impianti.net/ http://assistudioperboni.it/ |
|
s.dav
Site Admin
Italy
3364 Posts |
Posted - 03 Apr 2009 : 10:21:19
|
Probably you setup the form in a wrong way
The correct way to work with form is the following:
1- create one or more forms 2- put a "Submit" button into the form you want to send 3- in the "onSubmit" event of the form you have to return "false" for blocking the form to be sent to server or "true" to permit the form to be submitted to server
ex: <form onsubmit="return checkInput()" method="post" action="my.php">
Alternatively you can use simple buttons on forms (NOT submit buttons, because they submit the container form), manage their "onClick" event and raise a form submit when the data has been validated
ex:
if (checkInput()) myform.submit();
checkInput is a javascript function made by you that check for validation on your input fields and return false on error. |
Regards, Davide |
|
|
Testa
Expert
Italy
74 Posts |
Posted - 03 Apr 2009 : 16:34:56
|
I've a form named FormDatiAutoveicoli wich has three layers (1 visible and 2 non visible) , a PHP script named SendAutoveicoli.php and only one submit button inside form. When i click button i call a java function named checkForm.
Here the sample: <form id="FormDatiAutoveicoli" name="FormDatiAutoveicoli" style="position: absolute; left: 35px; top: 36px;" action="SendAutoveicoli.php" method="post" onsubmit="return checkForm (this) ;">.
When click on submit button i have: - Mozzilla: function make the right evaluation of all fields (also the field inside non-visible layers) and don't send any mail untill all required fields are not filled. - IE: function make the right evaluation only of the fields inside active layer. When all fields inside visible layer are filled, on submit, appear a msg box that tell about the need to fill the first field of non-visible layer, but when i click ok button, send the form).
Now i try your second propose, but i don't understand why i have two different situation browser-depending.
Thanks, Stefano T.
|
My Google+ profile: https://plus.google.com/i/zw25-_gKvTY:jRss3zGURdE
Web sites made in DHTML:
http://terapiabrevestrategica-emilia.it/ http://papaveriepapere-ravenna.com/ http://mp-impianti.net/ http://assistudioperboni.it/ |
|
|
Testa
Expert
Italy
74 Posts |
|
|
Topic |
|