I'm doing something wrong, but can't figure it out in various experiments I have tried. Hoping you can help.
Here is a synopsis of the issue. I have a Dynamic Form, bugForm. It contains a few TextBoxes, ComboBoxes and MultiComboBoxes. There is a 'Submit' button and a File Another checkBox. If the File Another check box is selected, the form clears itself after the response to the bugForm.submit() call, and the user can make a second set of choices, and can click the submit button a second time.
Everything works fine on the first submit, data is sent, recorded in the SQL DB, and success response returned. If the FIle Another checkBox is false in the submit() DSCallback the form bugForm is destroyed(), else the bugForm.reset() is called, and the values cleared.
But if the form is submitted a SECOND time, because the File Another checkbox was selected, and the user has input new form data, the bugForm.submit() call fires this exception:
_1.replace is not a function: at Object.makeXMLSafe
Here's a quick outline of the code
When this bugForm.submit is called the SECOND time, I get the internal exception described above.
Can you tell what I have forgotten to initialize the second time the submit.addClickHandler is called?
thanks
Here is a synopsis of the issue. I have a Dynamic Form, bugForm. It contains a few TextBoxes, ComboBoxes and MultiComboBoxes. There is a 'Submit' button and a File Another checkBox. If the File Another check box is selected, the form clears itself after the response to the bugForm.submit() call, and the user can make a second set of choices, and can click the submit button a second time.
Everything works fine on the first submit, data is sent, recorded in the SQL DB, and success response returned. If the FIle Another checkBox is false in the submit() DSCallback the form bugForm is destroyed(), else the bugForm.reset() is called, and the values cleared.
But if the form is submitted a SECOND time, because the File Another checkbox was selected, and the user has input new form data, the bugForm.submit() call fires this exception:
_1.replace is not a function: at Object.makeXMLSafe
Here's a quick outline of the code
Code:
final DynamicForm bugForm = new DynamicForm(); bugForm.setWidth100(); bugForm.setAutoHeight(); bugForm.setLayoutAlign(Alignment.CENTER); bugForm.setDataSource(DataSource.get("JIRA")); bugForm.setUseAllDataSourceFields(true); bugForm.setCellPadding(10); bugForm.setColWidths("33%", "66%"); bugForm.setAlign(Alignment.CENTER); bugForm.setSaveOperationType(DSOperationType.ADD); // some ComboBoxItems, TextItems, and AutoFitTextAreaItems are added as fields to the form. // The checkBox and IButton are added to a HLayout called buttons. They are not members of the Dyn. Form. // A DSCallback and DSRequest are defined final DSCallback fileCallback = new DSCallback() { @Override public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) { if (dsResponse.getStatus() < 0) { buttons.setDisabled(false); SC.say(dsResponse.getDataAsString()); } else { SC.say(dsResponse.getDataAsString()); if (Boolean.TRUE.equals(anotherBug.getValueAsBoolean())) { bugForm.reset(); extraChoicesForm.reset(); buttons.setDisabled(false); anotherBug.setValue(false); // Or user will repeated file JIRAs } else { destroy(); } } } }; final DSRequest reqProp = new DSRequest(); reqProp.setWillHandleError(true); reqProp.setOperationType(DSOperationType.ADD); reqProp.setDataSource("JIRA"); // The submit button gets this handler: submit.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { @Override public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) { if (bugForm.validate()) { buttons.setDisabled(true); loading.show(); if (jiraComponents.getValue() != null && !jiraComponents.getValueAsString().isEmpty()) { bugForm.setValue("Component", jiraComponents.getValue().toString()); } else if (defaultComponent != null) { bugForm.setValue("Component", defaultComponent.toString()); } if ( jiraVersion.getValueAsString() != null && ! jiraVersion.getValueAsString().isEmpty() ) { bugForm.setValue("Version", jiraVersion.getValueAsString()); } bugForm.submit(fileCallback, reqProp); } } });
Can you tell what I have forgotten to initialize the second time the submit.addClickHandler is called?
thanks
Comment