I can't seem to get ValuesManager or DynamicForm to disable validation.
My user story it to save a draft version of a record. On non-draft saves, all required fields must have values. For draft-save, the required fields are OK if empty but if they have values their format should pass other validators such as the regular expression for email addresses. So, Ideally I just want to disable the checks for 'required' but still run the other validations. But I can also get by with no validation at all for draft-saves.
As I understand it from the docs, to disable all validation just takes a call to setDisableValidation(true) on the ValuesManager. But when I step through with a debugger, it gets to the saveData call and does not call the server-side code due to validation errors.
(I'm using SmartGWT EE 2.5 nightly build, October 20. There are no errors / stack traces to report.)
From constructor...
Save Draft button...
Thanks in advance
,chris
My user story it to save a draft version of a record. On non-draft saves, all required fields must have values. For draft-save, the required fields are OK if empty but if they have values their format should pass other validators such as the regular expression for email addresses. So, Ideally I just want to disable the checks for 'required' but still run the other validations. But I can also get by with no validation at all for draft-saves.
As I understand it from the docs, to disable all validation just takes a call to setDisableValidation(true) on the ValuesManager. But when I step through with a debugger, it gets to the saveData call and does not call the server-side code due to validation errors.
(I'm using SmartGWT EE 2.5 nightly build, October 20. There are no errors / stack traces to report.)
From constructor...
Code:
leftForm = makeLeftColumn(); rightForm = makeRightColumn(); valuesManager = new ValuesManager(); valuesManager.setDataSource(DataSource.get(DATA_SOURCE)); valuesManager.addMember(leftForm); valuesManager.addMember(rightForm); valuesManager.setDisableValidation(true);
Code:
private Button makeSaveDraftButton() {
final Button draft = new Button("Save Draft");
draft.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
valuesManager.saveData(new DSCallback() {
@Override
public void execute(DSResponse dsResponse, Object o, DSRequest dsRequest) {
valuesManager.editRecord(dsResponse.getData()[0]);
SC.say("Draft saved.");
}
});
}
});
return draft;
}
,chris
Comment