javascript and ZPT
Here is a snippet from my template: ...... <td><input type="checkbox" name="c_row" tal:attributes="value row/id"></td> ...... <a href="" onclick="document.forms[0].c_row.checked = true; for(i=0; i<document.forms[0].c_row.length; i++) { document.forms[0].c_row[i].checked = true; } return false">Select all</a> <a href="" onclick="document.forms[0].c_row.checked = !document.forms[0].c_row.checked; for(i=0; i<document.forms[0].c_row.length; i++) { document.forms[0].c_row[i].checked = !document.forms[0].c_row[i].checked; } return false">Invert selection</a><br> ....... This works well but I need c_row to be passed as a list of integers. In this form it is passed as a string or list of strings. A good replacement I tought to be the follow one: ...... <td><input type="checkbox" name="c_row:list:int" tal:attributes="value row/id"></td> ...... but in this case I dont now how to handle javascript. Any help would be appreciated! TNX. --------------------------------------------------------------------------- This message (including any attachments) is confidential and may be privileged. If you have received it by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorised use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change. S.I.F. Oltenia S.A. shall not be liable for the improper or incomplete transmission of the information contained in this communication nor for any delay in its receipt or damage to your system. S.I.F. Oltenia S.A. does not guarantee that the integrity of this communication has been maintained nor that this communication is free of viruses, interceptions or interference. ---------------------------------------------------------------------------
eugen@sifolt.ro writes:
... <td><input type="checkbox" name="c_row:list:int" tal:attributes="value row/id"></td> ......
but in this case I dont now how to handle javascript. Javascript supports both atribute access as well as subscription syntax.
When you want to access an attribute with a name containing characters invalid in names, you can use: object['attribute_name'] Dieter
On Thu, Dec 19, 2002 at 12:26:00AM +0100, Dieter Maurer wrote:
eugen@sifolt.ro writes:
... <td><input type="checkbox" name="c_row:list:int" tal:attributes="value row/id"></td> ......
but in this case I dont now how to handle javascript. Javascript supports both atribute access as well as subscription syntax.
When you want to access an attribute with a name containing characters invalid in names, you can use:
object['attribute_name']
Dieter
I need to access an object like this: document.form[0].element_name where element_name is a group of checkboxes fields which contains invalid characters. AFAIK when a form contains a group of checkboxes with the same name, they ar placed in an array, and may be referenced like this: form.checkbox_name[i] form.elements['name'][j] Could you be more specific with your solution?
participants (3)
-
Dieter Maurer -
Eugen Nedelcu -
eugen@sifolt.ro