extjs4 - ExtJS 4.2.1 - Form custom field validation -


i working on form contains grid panel checkbox selection model select users. after submission users id's (as other form field values) posted server. works perfect.

but need add custom validation special (custom) field - if no user selected, display error icon error tooltip text. here custom field component screenshot:

custom form field - users grid checkbox selection model

as can see within image, there title (done xtype: label), empty space, filled label no text (the area marked red rectangle) , grid itself. if select user (or more), names (blanked data) displayed in empty label.

but within process of validation need show error icon tooltip somewhere here if no user selected.

i can check selected data using

grid.getselectionmodel().getselection().length > 0 ? true : false 

therefore wise of selection valid or not, not know how display error icon, nor should best display it. think best position icon should within section title label (either left or right, not matter much).

any on how display icon highly appreciated!

as nobody answered , found solution myself, want put here maybe tell me better approach.

so after validation

if(grid.getselectionmodel().getselection().length > 0) {     // valid, let's submit form... } else {    // invalid, let's show error hint } 

i need address concrete label , set text - while adding concrete html markup same of when error icon displayed calling form.isvalid():

label.settext(myprevioustext     + '<span role="presentation" class="x-form-error-msg x-form-invalid-icon" data-errorqtip="&lt;ul class=&quot;x-list-plain&quot;&gt;&lt;li role=&quot;alert&quot;&gt;'     + 'my error message'     + '&lt;/li&gt;&lt;/ul&gt;" style="display: inline-block;"></span>', false); 

now have error icon styled hint. set label text (set valid) on grid.select event , check validity again on grid.deselect event.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -