Validate Individual Form Field In Magento

Validating an individual form field in Magento is pretty easy.
You can use the inbuilt Magento function named Validation.validate().

You can do this in two way
1) Call the function from the individual field
2) Call the function on some event
Below is the example code to validate it on blur event.

 

<input class=”input-text required-entry” id=”name” title=”First Name” type=”text” name=”name” value=”” onblur=”validate(this)”/>

function validate(id){
Validation.validate(id);
}

Advertisements

One thought on “Validate Individual Form Field In Magento

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s