Announcement
Collapse
No announcement yet.
X
-
Hey Blama,
Thx for this workaround, should fit my needs :)
If I remember right there is a field.validate(); function, so the validation part can be done inside the onExitHandler.
Cheers,
JC
Leave a comment:
-
Hi JCarlson,
while this is not validating, you could solve your pre-fill case with an addEditorExitHandler. I'm doing a similar thing:
Code:addEditorExitHandler(new EditorExitHandler() { @Override public void onEditorExit(EditorExitEvent event) { if (ComboBoxItemZipcode.this.getValueAsString() != null && !ComboBoxItemZipcode.this.getValueAsString().isEmpty()) { zipcodeDS.fetchData(new AdvancedCriteria() { { buildCriterionFromList(OperatorId.AND, new Criterion[] { new Criterion("COUNTRY_ID", OperatorId.EQUALS, selectedCountry.getValueAsString()), new Criterion("ZIPCODE", OperatorId.EQUALS, ComboBoxItemZipcode.this.getValueAsString()) }); } }, new DSCallback() { @Override public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) { // Pre-fill the name of the city. if (Helper.oneRow(dsResponse)) { if (city != null && (city.getValue() == null || city.getValueAsString().isEmpty())) city.setValue(dsResponse.getDataAsRecordList().first().getAttributeAsString("SUGGESTION")); } ... ...
Best regards
Blama
Leave a comment:
-
Async Custom Validator for TextItem
Hey guys,
Is there a way to create an async custom validator?
I found an asny validation for the whole form, but as far as I understood it rlly is only for the whole form.
http://forums.smartclient.com/showthread.php?t=19145&highlight=asynchronous+validation
In my case I have a form and in the first Textfield the user should input some data, if the field loses focus (setValidateOnExit) I'm going to check if the input is valid and prefill some of the following fields.
Since the upper approach is validating the whole form many fields would show errors even if the user didn't reach them yet.
thx in advance,
JCTags: None
Leave a comment: