action
This function is an alias for theurl method.
Options |
Methods |
Events |
url method.
Sets the enctype attribute of the form element.
enctype option specified, using object in constructor
$A.newForm({enctype: 'multipart/form-data'}).draw();
Initialize the form widget with the enctype option specified, using method chaining
$A.newForm().enctype('multipart/form-data').draw();
enctype option, after initialization
var form = $A.newForm().draw();
//Setter
form.enctype('multipart/form-data'); //returns form
//Getter
console.log(form.enctype()); //returns value of enctype
By using this option you can insert html code on your form.
htmls option specified, using object in constructor
$A.newForm({htmls: ['<div>html content</div>']}).draw();
Initialize the form widget with the htmls option specified, using method chaining
$A.newForm().htmls(['<div>html content</div>']).draw();
htmls option, after initialization
var form = $A.newForm().draw();
//Setter
form.htmls(['<div>html content</div>']); //returns form
/*
form.htmls($('.element-to-insert')); //adding jQuery elements
*/
//Getter
console.log(form.htmls()); //returns the htmls array
The array of inputs added to the form.
inputs option specified, using object in constructor
$A.newForm({inputs: [$A.newInput(), $A.newInput()]}).draw();
Initialize the form widget with the inputs option specified, using method chaining
$A.newForm().inputs([$A.newInput(), $A.newInput()]).draw();
inputs option, after initialization
var form = $A.newForm().draw();
//Setter
form.inputs([$A.newInput(), $A.newInput()]); //returns form
//Getter
console.log(form.inputs()); //returns the inputs array
Use this option to set the method of the form element.
method option specified, using object in constructor
$A.newForm({method: 'POST'}).draw();
Initialize the form widget with the method option specified, using method chaining
$A.newForm().method('POST').draw();
method option, after initialization
var form=$A.newForm().draw();
//Setter
form.method('POST'); //returns form
//Getter
console.log(form.method()); //returns value of method
If set in constructor, the form will be automatically drawn to the target element.
target option specified, using object in constructor
$A.newForm({taget: $('body')});
The string containing the URL to which the request is sent.
url option specified, using object in constructor
$A.newForm({url: 'google.com'}).draw();
Initialize the form widget with the url option specified, using method chaining
$A.newForm().url('google.com').draw();
url option, after initialization
var form = $A.newForm().draw();
//Setter
form.url('google.com') //returns form
//Getter
console.log(form.url()) //returns value of url
Use this method to create groups of elements on your form.
Object
$A.newForm().draw().addGroup({
text: 'More options',
inputs: [
{
label: 'Import file',
help: "Select a file to upload that contains contact data that you want to import.",
type: 'file',
name: 'import-subscribers',
accept: ['.csv', '.rar', '.zip', '.tar', '.gz']
},
{
label: 'Apple',
validator: 'notEmpty'
}
]});
Use this function to add multiple groups to your form at once.
Array
$A.newForm().draw().addGroups([
{
text: 'Group 1',
inputs: [
{
label: 'Import file',
help: "Select a file to upload that contains contact data that you want to import.",
type: 'file',
name: 'import-subscribers',
accept: ['.csv', '.rar', '.zip', '.tar', '.gz']
},
{
label: 'Apple',
validator: 'notEmpty'
}
]
},
{
text: 'Group 2',
inputs: [
{
label: $A.translate('Stuff')
}
]
}]);
Use this method to add html code to your form.
String | jQuery
var form = $A.newForm().draw();
form.addHtml(['<div>html content</div>']); //returns form
form.addHtml($('.elements-to-insert')); //adding jQuery elements
Use this method ta add an input to your form.
Input
$A.newForm().addInput($A.newInput()).draw();
Use this method ta add multiple inputs to your form.
Array
$A.newForm().addInputs([$A.newInput(),$A.newInput()]).draw();
Use this method to add a subtitle to your form.
Subtitles will be displayed in new rows.
String
$A.newForm().addSubTitle('Title').draw();
Use this method to break line in your form.
Tehnically, a <br> tag will be appended to the widget's html.
//regardless the newRow: false attribute of the inputs, they'll be shown in new lines
$A.newForm().addInput({newRow: false}).break().addInput({newRow: false}).draw();
Invoke this function to draw the widget after initialization on the target element.
Invoking without parameter sets $('body') as target.
$A.newForm().addInput().draw()
With jQuery element parameter
var container = $('<div id="form-container"></div>').css({height: '200px', margin: '20px 10px', border:'2px solid #FF0000', position:'relative'}).appendTo('body')
var form = $A.newForm();
form.addInput();
form.draw(container);
addGroup(obj) method.
addGroups(arr) method.
Invoke this function to hide the widget.
var form = $A.newForm().draw();
form.addInput();
setTimeout(function (){
form.hide();
},1000);
addInput(obj) method.
Use this method to JSON stringify your from.
var form = $A.newForm({
inputs: [$A.newInput({label: 'Name:', value: 'John'})]
}).draw();
console.log(form.json());
Use this method to serializy the form.
var form = $A.newForm({
inputs: [$A.newInput({label: 'Name:', value: 'John'})]
}).draw();
console.log(form.object());
Use this method to remove a group from your form.
String
Give some examples here!
Use this method to remove a html from your form.
String
var form = $A.newForm().addHtml('content').draw();
var id = form.htmls()[0].attr('id');
setTimeout(function(){
form.removeHtml(id);
},1000);
Use this method to remove an input from the form.
Object | String
var form = $A.newForm().draw();
var input = $A.newInput().draw();
form.addInput(input);
setTimeout(function (){
form.removeInput(input);
}, 1000);
Use this to remove a subtitle from your form.
Object | String
var form = $A.newForm().draw();
form.addSubTitle('title');
setTimeout(function (){
form.removeSubTitle($($('.automizy-form-subtitle')[0]).attr('id'));
}, 1000);
Invoke this function to show the widget.
var form = $A.newForm().draw().hide();
form.addInput();
setTimeout(function(){
form.show();
},1000);
Use this method to submit the form.
var form = $A.newInput().draw().submit();
addSubTitle(str) method.
Use this method to run the validation process on all inputs in the form.
var form = $A.newInput().validator('email').draw().validate();