Gurus,
I have a form (text box added to form)created in a loop which is added to hlayout, and then hlayout is added to the vlayout. I have one more button called submit which is added to vlayout. when the user clicks the submit button, I should get all the values from the text boxes, I can get the lenght of the members but cant get the values of the text items. thanks in advance.
please see the sample example.
I have a form (text box added to form)created in a loop which is added to hlayout, and then hlayout is added to the vlayout. I have one more button called submit which is added to vlayout. when the user clicks the submit button, I should get all the values from the text boxes, I can get the lenght of the members but cant get the values of the text items. thanks in advance.
please see the sample example.
Code:
private VLayout vLayout = null; private VLayout vLayout1; private IButton button1; public void onModuleLoad(){ vLayout = new VLayout(); vLayout1 = new VLayout(); HLayout hLayout = null; DynamicForm form = null; int counter = 0; button1 = new IButton("Submit"); button1.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler(){ public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) { HashMap<String, String> map = new HashMap<String, String>(); SC.say ("members lenght is"+vLayout.getMembers().length); for (int i=1; i<vLayout.getMembers().length; i++){ //map.put("MARKS_"+i, vLayout.getValues()[i]); } } }); for (int i=0; i < 3; i=i+1) { hLayout = new HLayout(); hLayout.setAutoHeight(); form = new DynamicForm(); ++counter; TextItem txt1 = new TextItem(); txt1.setName("marks"+i); txt1.setStartRow(true); if (i == 0){ txt1.setTitle("Marks"); } else { txt1.setTitle(""); } txt1.setWidth(200); txt1.setValue(i); form.setFields(txt1); hLayout.addMember(form); vLayout.addMember(hLayout); } vLayout1.addMember(vLayout); vLayout1.addMember(button1); vLayout1.draw(); }
Comment