Module Ext_form_Basic


module Ext_form_Basic: sig .. end
Provides input field management, validation, submi ...

Provides input field management, validation, submission, and form loading services for the collection of Field instances within a Ext.container.Container. It is recommended that you use a Ext.form.Panel as the form container, as that has logic to automatically hook up an instance of Ext.form.Basic (plus other conveniences related to field configuration.)

Form Actions

The Basic class delegates the handling of form loads and submits to instances of Ext.form.action.Action. See the various Action implementations for specific details of each one's functionality, as well as the documentation for doAction which details the configuration options that can be specified in each action call.

The default submit Action is Ext.form.action.Submit, which uses an Ajax request to submit the form's values to a configured URL. To enable normal browser submission of an Ext form, use the standardSubmit config option.

File uploads

File uploads are not performed using normal 'Ajax' techniques; see the description for hasUpload for details. If you're using file uploads you should read the method description.

Example usage:

Ext.create('Ext.form.Panel', {
    title: 'Basic Form',
    renderTo: Ext.getBody(),
    bodyPadding: 5,
    width: 350,

    // Any configuration items here will be automatically passed along to
    // the Ext.form.Basic instance when it gets created.

    // The form will submit an AJAX request to this URL when submitted
    url: 'save-form.php',

    items: [{
        xtype: 'textfield',
        fieldLabel: 'Field',
        name: 'theField'
    }],

    buttons: [{
        text: 'Submit',
        handler: function() {
            // The getForm() method returns the Ext.form.Basic instance:
            var form = this.up('form').getForm();
            if (form.isValid()) {
                // Submit the Ajax request and handle the response
                form.submit({
                    success: function(form, action) {
                       Ext.Msg.alert('Success', action.result.message);
                    },
                    failure: function(form, action) {
                        Ext.Msg.alert('Failed', action.result ? action.result.message : 'No response');
                    }
                });
            }
        }
    }]
});


class type t = object .. end
class type configs = object .. end
class type events = object .. end
class type statics = object .. end
val of_configs : configs Js.t -> t Js.t
of_configs c casts a config object c to an instance of class t
val to_configs : t Js.t -> configs Js.t
to_configs o casts instance o of class t to a config object