PDA

View Full Version : extjs form warning?



cs01rsw
26 Oct 2010, 7:41 AM
Hi,

We have a form that has many fields including a textfield. The allowBlank attribute is set to false on this textfield.
The form has the monitorValid attribute set to true, and the save button has the formBind attribute set to true.

Therefore the save button remains disabled until the user has entered some text into the textfield. There is a red mark surrounding the textfield which states 'this field is required'.

However, we would still like them to save the form even though this field has no data in it. we are doing this as some users may not have the data, although we want to ensure we highlight that it is important they enter that information if they have it.

a possible solution we thought of was : the save button to be enabled and a yellow mark instead of a red one to surround the textfield showing a 'warning' on the textfield instead of an error.

would this be possible, or does anyone know of any other possible solution to this

thanks

mschwartz
26 Oct 2010, 10:22 AM
don't disable the button, don't do the formbinding thing.

Ext.getCmp('field-id').markInvalid('This is required');

cs01rsw
26 Oct 2010, 11:17 AM
thanks for the suggestion although the formbinding is good for the other fields on the form that have complex vtypes set.