2013년 10월 16일 수요일

Validating form fields with VTypes

1. We will start by defining our form and its fields. We will be using our example form
that was created in the first recipe of this chapter as our base.

2. Now that we have a form we can add the vtype configuration option to our e-mail
address field:
{
xtype: 'textfield',
fieldLabel: 'Email Address',
name: 'EmailAddress',
labelAlign: 'top',
cls: 'field-margin',
columnWidth: 0.6,
vtype: 'email'
}

3. That is all we have to do to add e-mail address validation to a field. We can see the
results in the following screenshot, with an incorrectly formatted e-mail address on
the left and a valid one on the right:


댓글 없음:

댓글 쓰기