I want to add a multisewate widget to a form set with some values. And when the user clicks on a button, the value inside the multisewate widget changes.
When I do this, the form crashes.
This is a sample code for the problem:
& lt; Script type = "text / javascript" & gt; Function testing () {var msObj = dijit.byId ('ms1'); MsObj.set ('label', ['val1', 'val2']); } & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body class = "claro" & gt; & Lt; H2 & gt; Multisac Test & lt; / H2 & gt; & Lt; H3 & gt; Click on the test button to see the new data loaded in Multipurpose Widget & lt; / H3 & gt; & Lt; Div data-dojo-type = "dijit / form / form" enctype = "multipart / form-data" action = "" method = "post" & gt; & Lt; Div data-dojo-type = "doodox / layout / table container" data-dojo-prop = "column: 1" & gt; & Lt; Select ID = "MS1" Data-Dojo-Type = "Digit / Form / Multi Seal" Title = "Multisector 123:" name = "Multi-Select" & gt; & Lt; Option value = "english 123" & gt; English 123 & lt; / Options & gt; & Lt; Option value = "1234.56" & gt; 1234.56 & lt; / Options & gt; & Lt; / Select & gt; & Lt; / Div & gt; & Lt; Br> & Lt; Button onclick = "test ()" & gt; Test & lt; / Button & gt; & Lt; / Body & gt;
The reason for the accident is that after clicking the button, the form gets deposited .
To avoid submitting a form, we need to return the incorrect value in the button click function. I.e
& lt; Button onclick = "test (); return back;" & Gt; Exam & lt; / Button & gt;
In addition, the multisage dojo widget is not connected to the data store / object. According to the documentation this is just a cover on the SELECT HTML element.
As a result you need to use the basic HTML / JS code to add and remove OPTIONS for the widget.
Check for a working example.
No comments:
Post a Comment