I can confirm that both Thiago's and Christophe's approaches work. In the
end I used Thiago's suggestion because although I gave the example of
needing to copy one text field, in fact I needed to do this for 10 fields so
passing 20 clientIds to a javascript function/constructor was less than
ideal. Thiago's suggestion worked especially well because I could do
something like

<input t:type="textField" t:id="techFirstName" class="tech" />
<input t:type="textField" t:id="techLastName" class="tech" />
...
<input t:type="textField" t:id="billingFirstName" class="billing" />
<input t:type="textField" t:id="billingLastName" class="billing" />

function copyDetails() {
  var techFields = $(('.tech');
  var billingFields = $(('.billing');
  for (var i = 0; i < techFields.length; i++) {
    // check field type
    ...
    // if field is textfield
    billingFields[i].value = techFields[i].value;
  }
}

Thanks to Thiago and Christophe!

Toby

2009/10/6 cordenier christophe <christophe.corden...@gmail.com>

> Thanks Thiago, never thought about this approach.
>
> Even if class is not unique, we would be able to find my elements like this
> too.
>

Reply via email to