New on DHTMLGoodies.com:
DHTML Chess is now available for WordPress at WordPressChess.com.
Download Ajax form submit
Download files
You can download the entire script from this Zip file.
Files included in package
- form-submit.html = Main HTML file
- js/form-submit.js = Main JS file
- js/ajax.js = Ajax (Library from http://twilightuniverse.com/projects/sack)
- form-submit.php = PHP file which parses submtted data and outputs them back to the screen.
Configuration
This is a standalone version of the form submit class available in the DHTML Suite. The DHTMLSuite.form class is used to send a form to the server via Ajax. This is an example of the Javascript code used to create a form object:
var formObj = new DHTMLSuite.form({
formRef:'myForm',
action:'includes/formSubmit.php',
responseEl:'formResponse'}
);
As you can see, properties are sent to the constructor in an associative array:
- formRef - Reference to the form. It could be a direct reference or the name or id of the form.
- method - How to post the form - Optional, default = "POST".
- action - Relative path to the file where the form will be submitted.
- responseEl - Reference to HTML element where response from the server will be inserted. It could be a direct reference or the id of the element
- responseFile - Path to alternative response file. When defined, the content of this file will be inserted into responseEl, i.e. instead of the response from the "action" file.
- callbackOnComplete - Name of callback function to execute when the form has been submitted. This function will receive the name of the form as only argument.
The method "submit" is used to submit the form. Example:
<INPUT type="button" value="Send" onclick="formObj.submit()">
File uploads
When the form contains one or more form elements, the form will be submitted to a dynamically created and hidden iframe. When the form is finished submitted, the content of this iframe will be inserted into the element defined as responseEl.
thank you!
When I tried ot submit to an ASP page, the asp page somehow captured double information for the checkboxes.
In your Demo, it shows in PHP, which is correct:
hobbies[0]: games
hobbies[1]: soccer
hobbies[2]: stamps
but when I submit it to an ASP Page, it shows double entry for Checkboxes. Others (text, radio, etc) are working fine.
hobbies[0] : games, games
hobbies[1] : soccer, soccer
hobbies[2] : stamps, stamps
Please advise
I need to contact admin.
Thank you.
The output is the php file, instead of the POST data or Get data.
My output:
Ajax form submit
Form posted with Ajax"; echo "
POST variables
"; foreach($_POST as $key=>$value){ if(is_array($value)){ for($no=0;$no".$key."[$no]: ".$value[$no]."
"; } }else{ echo "".$key.": ".$value."
"; } } echo "
GET variables:
"; foreach($_GET as $key=>$value){ if(is_array($value)){ for($no=0;$no".$key."[$no]: ".$value[$no]."
"; } }else{ echo "".$key.": ".$value."
"; } } ?>
Help please
This person is selling the secret of eternal youth:
http://makemoneyonline201834447.educationalimpactblog.com/1790383/about-about-anti-aging-products
https://www.pinterest.com/pin/794815034212879929
https://www.pinterest.com/pin/843721311416220833
https://www.pinterest.com/pin/590816044842500469
https://www.pinterest.com/pin/631911391441402290
https://www.pinterest.com/pin/775463629563962974
https://www.pinterest.com/pin/631911391441403420
This person is selling the secret of eternal youth:
https://www.pinterest.com/pin/825073594209244141
https://www.pinterest.com/pin/775463629563962552
https://www.pinterest.com/pin/825073594209245300
https://www.pinterest.com/pin/677721443901267707
https://www.pinterest.com/pin/748442031799729044
https://www.pinterest.com/pin/785807834958017609
https://www.pinterest.com/pin/644155552928877067
Post your comment
Comment preview: