0

We are developing a generic client using smartGWT. we design our application as: in Left of screen we have tree navigator, and in right we display form (onClick of a tree item) of the target tree-element. In displaying forms we are using notebooks, i.e. whenever one clicks a tree-item we add a tab in notebook to display its relevant form. So multiple form may exist in DOM at the same time.

 My query is:
 what if multiple notebooks (thus different forms) say X and Y have same-field-widget say 'name', 
 Will this cause ID conflict problem in operation like `save` or `onchange` or simply is this a good practice in smartGWT?

Note: we want to generate same ID of the widget each time we generate particular form, for some testing purpose.
Shanta
  • 262
  • 1
  • 4
  • 15
  • Have you written some code according to your requirements? Can you post it here? – RAS Nov 24 '11 at 05:45
  • Actually, currently we didn't assigned ID to widget they are auto-generated. But as I have said, when performing testing (using Selenium), I thought that assigning unique ID will solve our problem with selenium, so asked this ambiguity. – Shanta Nov 25 '11 at 12:08

1 Answers1

0

Having a look at this link shows there is no offense to good practises to use same attribute names in different forms But anyway with SmartGWt if you run the simple following test code you can see with Firebug that the id and the name attributes are autogenerated with incremented values so there are even no duplicate values...

public static void testMultiForms() {
    VLayout theForms = new VLayout();
    MyForm f1 = new MyForm();
    MyForm f2 = new MyForm();
    MyForm f3 = new MyForm();
    theForms.addMember(f1);
    theForms.addMember(f2);
    theForms.addMember(f3);
    RootPanel.get("container").add(theForms);       
}

public MyForm(){
    TextItem name = new TextItem();
    name.setTitle("Name");
    TextItem address = new TextItem();
    address.setTitle("Address");
    this.setItems(name,address);
}       
Community
  • 1
  • 1
Alain BUFERNE
  • 2,016
  • 3
  • 26
  • 37