Scroll Top

Adding a red asterisk to the required form fields

Getting your Trinity Audio player ready...

In the application development, there are instances when we have to indicate a mandatory form field by showing a red asterisk next to the field label.

The code here overrides the private function of the Ext.form.FormLayout and works with a custom property required. I chose the form layout as the rendering of the labels is taken care by this layout. Another option was to use the allowBlank property but just to keep things simple I have used the custom config required.

For ExtJS version 2.2.x

 

For ExtJs version 3.0.x

 

Following is a typical usage:

Related Posts

Leave a comment

Privacy Preferences
When you visit our website, it may store information through your browser from specific services, usually in form of cookies. Here you can change your privacy preferences. Please note that blocking some types of cookies may impact your experience on our website and the services we offer.