DHTMLSuite.form

DHTML Suite - article index

Specifications

Configuration

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

Support for file uploads has been implemented in DHTML Suite version 1.7.1. 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.

Advertisement:
LudoJS framework
dhtmlchess.com
Go to cbolson.com


About/Contact | A good idea? | Submit a script | Privacy notice
© 2005 - 2017 dhtmlgoodies.com