dtml-in function using input/text value
Hi all, I swear I must be braindead. Having trouble passing the value stored in an Input/text control to a python function used in a dtml-in statement. The text box "asset_type_id" contains the value I wish to pass to the function "f_list_get_asset_type_cfg". The zope error is: "global name 'asset_type_id' is not defined" Following is the code I am currently using. <input name="asset_type_id" type="hidden" value="1"> <p> Asset Column Associations for the Selected Type of Asset<br> <TABLE border=1 id=Table1 name="Table1"> <dtml-in prefix="asset_type_cols" expr="f_list_get_asset_type_cfg(asset_type_id)"> <TR> <TD> <P><dtml-var col_name></P> <TD> <P><dtml-var column_name></P> </dtml-in> </TABLE> </p> Thanks!
Your view of what will happen is different from what will really happen. The input field will not get assigned a value until someone fills in the form and submits it. By that time, the dtml code will have been executed and will no longer exist in the page. You cannot communicate to Zope the value of a form that has not been submitted. Instead, you need to put the form in a different page. When the user submits the form, its action invokes the page with the dtml code. Then the form data will be available to that page, because it has already been filled in. Cheers, Tom P [Mark A. Robinson] I swear I must be braindead. Having trouble passing the value stored in an Input/text control to a python function used in a dtml-in statement. The text box "asset_type_id" contains the value I wish to pass to the function "f_list_get_asset_type_cfg". The zope error is: "global name 'asset_type_id' is not defined" Following is the code I am currently using. <input name="asset_type_id" type="hidden" value="1"> <p> Asset Column Associations for the Selected Type of Asset<br> <TABLE border=1 id=Table1 name="Table1"> <dtml-in prefix="asset_type_cols" expr="f_list_get_asset_type_cfg(asset_type_id)"> <TR> <TD> <P><dtml-var col_name></P> <TD> <P><dtml-var column_name></P> </dtml-in> </TABLE> </p>
participants (2)
-
Mark A. Robinson -
Thomas B. Passin