| Name | Type | Default |
|
padding
# |
Any
|
{ left: 5, top: 5, right: 5, bottom: 5 }
|
Gets or sets the jqxForm's padding property.
import { Component } from '@angular/core';
import { jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: `
<jqxForm
#formReference
[width]="400"
[height]="'auto'"
[padding]="padding"
[template]="template"
[value]="sampleValue"
>
</jqxForm>
`
})
export class App {
padding: any = { left: 10, top: 10, right: 10, bottom: 10 };
template: any[] = [
{
bind: 'firstName',
type: 'text',
label: 'First name',
required: true,
labelWidth: '80px',
width: '250px',
info: 'Enter first name',
infoPosition: 'right'
},
{
bind: 'lastName',
type: 'text',
label: 'Last name',
required: true,
labelWidth: '80px',
width: '250px',
info: 'Enter last name'
}
];
sampleValue = { firstName: 'John', lastName: 'Scott' };
}
|
|
backgroundColor
# |
String
|
#F5F5F5
|
Sets or gets the backgroundColor property.
import { Component } from '@angular/core';
import { jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: `
<jqxForm
#formReference
[width]="400"
[height]="'auto'"
[backgroundColor]="backgroundColor"
[template]="template"
[value]="sampleValue"
>
</jqxForm>
`
})
export class App {
backgroundColor: string = '#fafafa';
template: any[] = [
{
bind: 'firstName',
type: 'text',
label: 'First name',
required: true,
labelWidth: '80px',
width: '250px',
info: 'Enter first name',
infoPosition: 'right'
},
{
bind: 'lastName',
type: 'text',
label: 'Last name',
required: true,
labelWidth: '80px',
width: '250px',
info: 'Enter last name'
}
];
sampleValue = { firstName: 'John', lastName: 'Scott' };
}
|
|
borderColor
# |
String
|
#E5E5E5
|
Sets or gets the borderColor property.
import { Component } from '@angular/core';
import { jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: `
<jqxForm
#formReference
[width]="400"
[height]="'auto'"
[borderColor]="borderColor"
[template]="template"
[value]="sampleValue"
>
</jqxForm>
`
})
export class App {
borderColor: string = '#fafafa';
template: any[] = [
{
bind: 'firstName',
type: 'text',
label: 'First name',
required: true,
labelWidth: '80px',
width: '250px',
info: 'Enter first name',
infoPosition: 'right'
},
{
bind: 'lastName',
type: 'text',
label: 'Last name',
required: true,
labelWidth: '80px',
width: '250px',
info: 'Enter last name'
}
];
sampleValue = { firstName: 'John', lastName: 'Scott' };
}
|
|
theme
# |
String
|
''
|
import { Component, viewChild } from '@angular/core';
import { jqxFormComponent, jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: `<jqxForm
#myForm
style="width: 450; height: 'auto'"
[template]="template"
[value]="value"
[theme]="'material'"
>
</jqxForm>`,
styles: [``]
})
export class App {
readonly myForm = viewChild.required<jqxFormComponent>('myForm');
public template = [
{
bind: 'textBoxValue',
type: 'text',
label: 'Text input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
bind: 'passwordBoxValue',
type: 'password',
label: 'Password input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
bind: 'numberBoxValue',
type: 'number',
label: 'Number input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
name: 'submitButton',
type: 'button',
text: 'Submit Form Data',
align: 'right',
padding: { left: 0, top: 5, bottom: 5, right: 40 }
}
];
public value = {
textBoxValue: 'text box value',
passwordBoxValue: 'password box',
numberBoxValue: 67.44
};
private onButtonClick(event: any) {
alert('Button Clicked...');
}
}
|
|
value
# |
Any
|
{}
|
Sets or gets the value property.
import { Component } from '@angular/core';
import { jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: `
<jqxForm
#formReference
[width]="400"
[height]="'auto'"
[template]="template"
[value]="sampleValue"
>
</jqxForm>
`
})
export class App {
template: any[] = [
{
bind: 'firstName',
type: 'text',
label: 'First name',
required: true,
labelWidth: '80px',
width: '250px',
info: 'Enter first name',
infoPosition: 'right'
},
{
bind: 'lastName',
type: 'text',
label: 'Last name',
required: true,
labelWidth: '80px',
width: '250px',
info: 'Enter last name'
}
];
sampleValue = { firstName: 'John', lastName: 'Scott' };
}
|
|
template
# |
Array <FormTemplateItem>
|
scheme01
|
Gets or sets the jqxForm's template. Each object in the template, represents a Form row. Each row can have one field with label or multiple fields (if the current object's columns property is defined).
Template options:
- bind - Sets a template's member Name.
- type - Sets a template member's type. Possible values: 'text', 'option', 'blank', 'button', 'color', 'number', 'boolean', 'password', 'label', 'time', 'date', 'datetime', 'custom'.
- label - Sets the label displayed next to the field.
- labelWidth - Sets the with o label displayed next to the field.
- required - Sets whether the field is optional or not.
- info - Sets the field information icon's tooltip.
- infoPosition - Sets the information icon's position.
- component - Sets the component's type. 'jqxDropDownList' when type is 'option'. By default, the component type is jqxRadioButton for the 'option' type.
- options - Sets the 'option' type's options.
- init - Sets the callback function for 'custom' type initialization.
- rowHeight - Sets the row's height.
- width - Sets the row's width.
- columns - Sets the row's columns.
- align - Sets the alignment of the field. Possible values: 'right', 'center', 'left'
- valign - Sets the vertical alignment of the field. Possible values: 'top', 'center', 'bottom'
- columnWidth - Sets the column's width.
interface GridColumn {
bind?: String;
type?: String;
label?: String;
labelWidth?: String;
required?: Boolean;
info?: String;
infoPosition?: String;
component?: String;
options?: Array<any>;
init?: (value: any) => void;
rowHeight?: Number | String;
width?: Number | String;
columns?: Array<FormTemplateItem>;
align?: String;
valign?: String;
columnWidth?: Number | String;
}
import { Component } from '@angular/core';
import { jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: `
<jqxForm
#formReference
[width]="400"
[height]="'auto'"
[template]="template"
[value]="sampleValue"
>
</jqxForm>
`
})
export class App {
columns: Array<jqwidgets.FormTemplateItem> = [
{
columnWidth: '140px',
bind: 'checkboxValue1',
type: 'boolean',
label: 'Checkbox 1',
labelPosition: 'right',
align: 'left',
labelPadding: { left: 0, top: 5, right: 0, bottom: 5 }
},
{
columnWidth: '140px',
bind: 'checkboxValue2',
type: 'boolean',
label: 'Checkbox 2',
labelPosition: 'right',
align: 'left',
labelPadding: { left: 0, top: 5, right: 0, bottom: 5 }
},
{
columnWidth: '140px',
bind: 'checkboxValue3',
type: 'boolean',
label: 'Checkbox 3',
labelPosition: 'right',
align: 'left',
labelPadding: { left: 0, top: 5, right: 0, bottom: 5 }
}
];
template: any[] = [
{
bind: 'firstName',
type: 'text',
label: 'First name',
required: true,
labelWidth: '80px',
width: '250px',
info: 'Enter first name',
infoPosition: 'right'
},
{
bind: 'lastName',
type: 'text',
label: 'Last name',
required: true,
labelWidth: '80px',
width: '250px',
info: 'Enter last name'
},
{
bind: 'company',
type: 'text',
label: 'Company',
required: false,
labelWidth: '80px',
width: '250px'
},
{
bind: 'address',
type: 'text',
label: 'Address',
required: true,
labelWidth: '80px',
width: '250px'
},
{
bind: 'city',
type: 'text',
label: 'City',
required: true,
labelWidth: '80px',
width: '250px'
},
{
bind: 'state',
type: 'option',
label: 'State',
required: true,
labelWidth: '80px',
width: '250px',
component: 'jqxDropDownList',
options: [
{ value: 'California' },
{ value: 'New York' },
{ value: 'Oregon' },
{ value: 'Illinois' },
{ value: 'Texas' }
]
},
{
bind: 'zip',
type: 'text',
label: 'Zip code',
required: true,
labelWidth: '80px',
width: '250px'
},
{ type: 'blank', rowHeight: '10px' },
{ columns: this.columns }
];
sampleValue = {
firstName: 'John',
lastName: 'Scott',
address: '1st Ave SW',
city: 'San Antonio',
state: 'Texas',
zip: '78209'
};
}
|
|
enableSmartPaste
# |
Boolean
|
|
import { Component, viewChild } from '@angular/core';
import { jqxFormComponent, jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: `<jqxForm
#myForm
style="width: 450; height: 'auto'"
[template]="template"
[value]="value"
>
</jqxForm>`,
styles: [``]
})
export class App {
readonly myForm = viewChild.required<jqxFormComponent>('myForm');
public template = [
{
bind: 'textBoxValue',
type: 'text',
label: 'Text input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
bind: 'passwordBoxValue',
type: 'password',
label: 'Password input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
bind: 'numberBoxValue',
type: 'number',
label: 'Number input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
name: 'submitButton',
type: 'button',
text: 'Submit Form Data',
align: 'right',
padding: { left: 0, top: 5, bottom: 5, right: 40 }
}
];
public value = {
textBoxValue: 'text box value',
passwordBoxValue: 'password box',
numberBoxValue: 67.44
};
private onButtonClick(event: any) {
alert('Button Clicked...');
}
}
|
|
aiKey
# |
String
|
|
import { Component, viewChild } from '@angular/core';
import { jqxFormComponent, jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: `<jqxForm
#myForm
style="width: 450; height: 'auto'"
[template]="template"
[value]="value"
>
</jqxForm>`,
styles: [``]
})
export class App {
readonly myForm = viewChild.required<jqxFormComponent>('myForm');
public template = [
{
bind: 'textBoxValue',
type: 'text',
label: 'Text input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
bind: 'passwordBoxValue',
type: 'password',
label: 'Password input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
bind: 'numberBoxValue',
type: 'number',
label: 'Number input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
name: 'submitButton',
type: 'button',
text: 'Submit Form Data',
align: 'right',
padding: { left: 0, top: 5, bottom: 5, right: 40 }
}
];
public value = {
textBoxValue: 'text box value',
passwordBoxValue: 'password box',
numberBoxValue: 67.44
};
private onButtonClick(event: any) {
alert('Button Clicked...');
}
}
|
|
aiUrl
# |
String
|
|
import { Component, viewChild } from '@angular/core';
import { jqxFormComponent, jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: `<jqxForm
#myForm
style="width: 450; height: 'auto'"
[template]="template"
[value]="value"
>
</jqxForm>`,
styles: [``]
})
export class App {
readonly myForm = viewChild.required<jqxFormComponent>('myForm');
public template = [
{
bind: 'textBoxValue',
type: 'text',
label: 'Text input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
bind: 'passwordBoxValue',
type: 'password',
label: 'Password input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
bind: 'numberBoxValue',
type: 'number',
label: 'Number input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
name: 'submitButton',
type: 'button',
text: 'Submit Form Data',
align: 'right',
padding: { left: 0, top: 5, bottom: 5, right: 40 }
}
];
public value = {
textBoxValue: 'text box value',
passwordBoxValue: 'password box',
numberBoxValue: 67.44
};
private onButtonClick(event: any) {
alert('Button Clicked...');
}
}
|
|
width
# |
String | Number
|
'100%'
|
Sets or gets the width property.
import { Component } from '@angular/core';
import { jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: `
<jqxForm #formReference [width]="400" [template]="template" [value]="sampleValue">
</jqxForm>
`
})
export class App {
template: any[] = [
{
bind: 'firstName',
type: 'text',
label: 'First name',
required: true,
labelWidth: '80px',
width: '250px',
info: 'Enter first name',
infoPosition: 'right'
},
{
bind: 'lastName',
type: 'text',
label: 'Last name',
required: true,
labelWidth: '80px',
width: '250px',
info: 'Enter last name'
}
];
sampleValue = { firstName: 'John', lastName: 'Scott' };
}
|
|
|
|
formDataChange
# |
Event
|
|
Understand when the input value (number) is changed.
Code examples #
Bind to the drawEnd event of jqxForm.
import { Component } from '@angular/core';
import { jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: ` <jqxForm
#formReference
(onFormDataChange)="formDataChange($event)"
[width]="400"
[height]="'auto'"
[template]="template"
[value]="sampleValue"
>
</jqxForm>`
})
export class App {
template: any[] = [
{ bind: 'firstName', type: 'text', label: 'First name', required: true },
{ bind: 'lastName', type: 'text', label: 'Last name', required: true },
{
columns: [
{ type: 'button', text: 'Sign up' },
{ type: 'button', text: 'Cancel' }
]
}
];
sampleValue = { firstName: 'John', lastName: 'Scott' };
formDataChange(event: any): void {
let args = event.args;
let previousValue = args.previousValue;
let value = args.value;
}
}
|
|
buttonClick
# |
Event
|
|
The buttonClick event is fired when clicking on some of the form's buttons.
Code examples #
Bind to the buttonClick event of jqxForm.
import { Component } from '@angular/core';
import { jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: ` <jqxForm
#formReference
(onButtonClick)="buttonClick($event)"
[width]="400"
[height]="'auto'"
[template]="template"
[value]="sampleValue"
>
</jqxForm>`
})
export class App {
template: any[] = [
{ bind: 'firstName', type: 'text', label: 'First name', required: true },
{ bind: 'lastName', type: 'text', label: 'Last name', required: true },
{
columns: [
{ type: 'button', text: 'Sign up' },
{ type: 'button', text: 'Cancel' }
]
}
];
sampleValue = { firstName: 'John', lastName: 'Scott' };
buttonClick(event: any): void {
let args = event.args;
let buttonName = args.text;
}
}
|
|
|
| Name | Return Type | Arguments |
|
getInstance
# |
|
|
Method: getInstance
import { Component, viewChild } from '@angular/core';
import { jqxFormComponent, jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: `<jqxForm
#myForm
style="width: 450; height: 'auto'"
[template]="template"
[value]="value"
>
</jqxForm>`,
styles: [``]
})
export class App {
readonly myForm = viewChild.required<jqxFormComponent>('myForm');
public template = [
{
bind: 'textBoxValue',
type: 'text',
label: 'Text input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
bind: 'passwordBoxValue',
type: 'password',
label: 'Password input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
bind: 'numberBoxValue',
type: 'number',
label: 'Number input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
name: 'submitButton',
type: 'button',
text: 'Submit Form Data',
align: 'right',
padding: { left: 0, top: 5, bottom: 5, right: 40 }
}
];
public value = {
textBoxValue: 'text box value',
passwordBoxValue: 'password box',
numberBoxValue: 67.44
};
public ngAfterViewInit(): void {
this.myForm().getInstance();
}
private onButtonClick(event: any) {
alert('Button Clicked...');
}
}
|
|
refresh
# |
Void
|
None
|
import { Component, AfterViewInit, viewChild } from '@angular/core';
import { jqxFormComponent, jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: ` <jqxForm
#formReference
[width]="400"
[height]="'auto'"
[template]="template"
[value]="sampleValue"
>
</jqxForm>`
})
export class App implements AfterViewInit {
readonly myForm = viewChild.required<jqxFormComponent>('formReference');
ngAfterViewInit(): void {
this.myForm().refresh();
}
template: any[] = [
{ bind: 'firstName', type: 'text', label: 'First name', required: true },
{ bind: 'lastName', type: 'text', label: 'Last name', required: true }
];
sampleValue = { firstName: 'John', lastName: 'Scott' };
}
|
|
destroy
# |
Void
|
None
|
import { Component, AfterViewInit, viewChild } from '@angular/core';
import { jqxFormComponent, jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: ` <jqxForm
#formReference
[width]="400"
[height]="'auto'"
[template]="template"
[value]="sampleValue"
>
</jqxForm>`
})
export class App implements AfterViewInit {
readonly myForm = viewChild.required<jqxFormComponent>('formReference');
ngAfterViewInit(): void {
this.myForm().destroy();
}
template: any[] = [
{ bind: 'firstName', type: 'text', label: 'First name', required: true },
{ bind: 'lastName', type: 'text', label: 'Last name', required: true }
];
sampleValue = { firstName: 'John', lastName: 'Scott' };
}
|
|
hideComponent
# |
Void
|
componentName: String
|
import { Component, AfterViewInit, viewChild } from '@angular/core';
import { jqxFormComponent, jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: ` <jqxForm
#formReference
[width]="400"
[height]="'auto'"
[template]="template"
[value]="sampleValue"
>
</jqxForm>`
})
export class App implements AfterViewInit {
readonly myForm = viewChild.required<jqxFormComponent>('formReference');
ngAfterViewInit(): void {
this.myForm().hideComponent('submitButton');
}
template: any[] = [
{ bind: 'firstName', type: 'text', label: 'First name', required: true },
{ bind: 'lastName', type: 'text', label: 'Last name', required: true },
{ columns: [{ name: 'submitButton', type: 'button', text: 'Submit' }] }
];
sampleValue = { firstName: 'John', lastName: 'Scott' };
}
|
|
showComponent
# |
Void
|
componentName: String
|
import { Component, AfterViewInit, viewChild } from '@angular/core';
import { jqxFormComponent, jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: ` <jqxForm
#formReference
[width]="400"
[height]="'auto'"
[template]="template"
[value]="sampleValue"
>
</jqxForm>`
})
export class App implements AfterViewInit {
readonly myForm = viewChild.required<jqxFormComponent>('formReference');
ngAfterViewInit(): void {
this.myForm().showComponent('submitButton');
}
template: any[] = [
{ bind: 'firstName', type: 'text', label: 'First name', required: true },
{ bind: 'lastName', type: 'text', label: 'Last name', required: true },
{ columns: [{ name: 'submitButton', type: 'button', text: 'Submit' }] }
];
sampleValue = { firstName: 'John', lastName: 'Scott' };
}
|
|
val
# |
Array<FormTemplateItem>
|
value: Array<FormTemplateItem>
|
import { Component, AfterViewInit, viewChild } from '@angular/core';
import { jqxFormComponent, jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({
selector: 'app-root',
imports: [jqxFormModule],
template: ` <jqxForm
#formReference
[width]="400"
[height]="'auto'"
[template]="template"
[value]="sampleValue"
>
</jqxForm>`
})
export class App implements AfterViewInit {
readonly myForm = viewChild.required<jqxFormComponent>('formReference');
ngAfterViewInit(): void {
this.myForm().destroy();
}
template: any[] = [
{ bind: 'firstName', type: 'text', label: 'First name', required: true },
{ bind: 'lastName', type: 'text', label: 'Last name', required: true }
];
sampleValue = { firstName: 'John', lastName: 'Scott' };
}
|
|
submit
# |
Void
|
action?: String;
target?: String;
method?: String;
|
Submits the form.
import { Component, AfterViewInit, viewChild } from '@angular/core';
import { jqxFormComponent, jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({ selector: 'app-root', imports: [jqxFormModule], templateUrl: 'app.html' })
export class App implements AfterViewInit {
readonly myForm = viewChild.required<jqxFormComponent>('myForm');
ngAfterViewInit(): void {
let form = this.myForm();
let btn = form.getComponentByName('submitButton');
btn.on('click', function () {
// function: submit
// arg1: url
// arg2, optional: target, default is _blank
// arg3, optional: submit method - GET or POST, default is POST
form.submit('https://www.jqwidgets.com/form_demo/', '_blank', 'POST');
});
}
columns: Array<jqwidgets.FormTemplateItem> = [
{
columnWidth: '140px',
bind: 'checkboxValue1',
type: 'boolean',
label: 'Checkbox 1',
labelPosition: 'right',
align: 'left',
labelPadding: { left: 0, top: 5, right: 0, bottom: 5 }
},
{
columnWidth: '140px',
bind: 'checkboxValue2',
type: 'boolean',
label: 'Checkbox 2',
labelPosition: 'right',
align: 'left',
labelPadding: { left: 0, top: 5, right: 0, bottom: 5 }
},
{
columnWidth: '140px',
bind: 'checkboxValue3',
type: 'boolean',
label: 'Checkbox 3',
labelPosition: 'right',
align: 'left',
labelPadding: { left: 0, top: 5, right: 0, bottom: 5 }
}
];
template: Array<jqwidgets.FormTemplateItem> = [
{
bind: 'textBoxValue',
type: 'text',
label: 'Text input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
bind: 'passwordBoxValue',
type: 'password',
label: 'Password input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
bind: 'nubmberBoxValue',
type: 'number',
label: 'Number input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
bind: 'dropdownValue',
type: 'option',
label: 'Drop down list',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true,
component: 'jqxDropDownList',
options: [
{ label: 'Option 1', value: 'value1' },
{ label: 'Option 2', value: 'value2' },
{ label: 'Option 3', value: 'value3' }
]
},
{ type: 'label', label: 'Radio buttons:', rowHeight: '40px' },
{
bind: 'radiobuttonValue',
type: 'option',
label: 'Radio buttons',
labelPosition: 'right',
columnWidth: '150px',
align: 'left',
optionsLayout: 'horizontal',
options: [
{ label: 'Option 1', value: 'value1' },
{ label: 'Option 2', value: 'value2' },
{ label: 'Option 3', value: 'value3' }
]
},
{
type: 'label',
bind: 'radiobuttonValue_out',
label: 'Boolean options / checkboxes:',
rowHeight: '40px'
},
{ columns: this.columns },
{ type: 'blank', rowHeight: '20px' },
{
name: 'submitButton',
type: 'button',
text: 'Submit Form Data',
align: 'right',
padding: { left: 0, top: 5, bottom: 5, right: 40 }
}
];
sampleValue: any = {
textBoxValue: 'text box value',
passwordBoxValue: 'password box',
nubmberBoxValue: 67.44,
dropdownValue: 'value3',
radiobuttonValue: 'value2',
checkboxValue1: false,
checkboxValue2: false,
checkboxValue3: true
};
}
|
|
getComponentByName
# |
Void
|
componentName: String
|
Gets a form input element by name.
import { Component, AfterViewInit, viewChild } from '@angular/core';
import { jqxFormComponent, jqxFormModule } from 'jqwidgets-ng/jqxform';
@Component({ selector: 'app-root', imports: [jqxFormModule], templateUrl: 'app.html' })
export class App implements AfterViewInit {
readonly myForm = viewChild.required<jqxFormComponent>('myForm');
ngAfterViewInit(): void {
let form = this.myForm();
let btn = form.getComponentByName('submitButton');
btn.on('click', function () {
// function: submit
// arg1: url
// arg2, optional: target, default is _blank
// arg3, optional: submit method - GET or POST, default is POST
form.submit('https://www.jqwidgets.com/form_demo/', '_blank', 'POST');
});
}
columns: Array<jqwidgets.FormTemplateItem> = [
{
columnWidth: '140px',
bind: 'checkboxValue1',
type: 'boolean',
label: 'Checkbox 1',
labelPosition: 'right',
align: 'left',
labelPadding: { left: 0, top: 5, right: 0, bottom: 5 }
},
{
columnWidth: '140px',
bind: 'checkboxValue2',
type: 'boolean',
label: 'Checkbox 2',
labelPosition: 'right',
align: 'left',
labelPadding: { left: 0, top: 5, right: 0, bottom: 5 }
},
{
columnWidth: '140px',
bind: 'checkboxValue3',
type: 'boolean',
label: 'Checkbox 3',
labelPosition: 'right',
align: 'left',
labelPadding: { left: 0, top: 5, right: 0, bottom: 5 }
}
];
template: Array<jqwidgets.FormTemplateItem> = [
{
bind: 'textBoxValue',
type: 'text',
label: 'Text input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
bind: 'passwordBoxValue',
type: 'password',
label: 'Password input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
bind: 'nubmberBoxValue',
type: 'number',
label: 'Number input',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true
},
{
bind: 'dropdownValue',
type: 'option',
label: 'Drop down list',
labelPosition: 'left',
labelWidth: '30%',
align: 'left',
width: '250px',
required: true,
component: 'jqxDropDownList',
options: [
{ label: 'Option 1', value: 'value1' },
{ label: 'Option 2', value: 'value2' },
{ label: 'Option 3', value: 'value3' }
]
},
{ type: 'label', label: 'Radio buttons:', rowHeight: '40px' },
{
bind: 'radiobuttonValue',
type: 'option',
label: 'Radio buttons',
labelPosition: 'right',
columnWidth: '150px',
align: 'left',
optionsLayout: 'horizontal',
options: [
{ label: 'Option 1', value: 'value1' },
{ label: 'Option 2', value: 'value2' },
{ label: 'Option 3', value: 'value3' }
]
},
{
type: 'label',
bind: 'radiobuttonValue_out',
label: 'Boolean options / checkboxes:',
rowHeight: '40px'
},
{ columns: this.columns },
{ type: 'blank', rowHeight: '20px' },
{
name: 'submitButton',
type: 'button',
text: 'Submit Form Data',
align: 'right',
padding: { left: 0, top: 5, bottom: 5, right: 40 }
}
];
sampleValue: any = {
textBoxValue: 'text box value',
passwordBoxValue: 'password box',
nubmberBoxValue: 67.44,
dropdownValue: 'value3',
radiobuttonValue: 'value2',
checkboxValue1: false,
checkboxValue2: false,
checkboxValue3: true
};
}
|