Helpful Information
 
 
Category: Python Programming
Populate a text area in Zope from ZSQL method

I have a field in a form which needs to be auto populated by the results of a ZSQL method. The result of the ZSQL is outputted to a column name called HIGH_AVG. I need the output of that column to auto populate a text box on the form

<input type=text value=(return of sql method)>

I have tried this
<input type=text name=HIGH_AVG value="<dtml-in sql_method_name>" </dtml-in> >

Please help with this problem
wabirdman

i think you want to put the <dtml-in> call outside the html tag.. like this:

<dtml-in sql_method_name>
<INPUT TYPE="TEXT" VALUE="<dtml-var sql_column_name>">
</dtml-in>

be aware that if your query returns more than one record, you will end up with a number of text fields each containing the appropriate text from one of the records.

I tried doing that yitz, but it still has not worked. The only other thing I can think of is this. I only want 1 field from the ZSQL method to be returned in to the text box. I have tried cutting the ZSQL so that it only returns one field and that still does not work. I am at a complete loss as to what is happening. Is there a way in which you can call a particular field to be auto populated??

Cheers
wabirdman

Thanks anyway, but I have worked it out. I also was able to have radio buttons that changed the value in the text box.

code for anyone who cares

<table>
<tr>
<td></td>
<TD valign="top" NOWRAP><B>Average Spend:</B></TD>
<td><!--#in sql_handset_details_for_handset_code --><input type=text name=HIGH_AVG value="<!--#var HIGH_AVG -->"><!--#/in--></td>
<TD>&nbsp;<B>3 Month:</B> <!--#var 3_MONTH_AVG --> <INPUT type="radio" name="AVG_CALL_SPEND_BASIS" value="3M" language=javascript onclick="document.thisForm.HIGH_AVG.value='<!--#var 3_MONTH_AVG -->';" checked>&nbsp;</TD>
<TD>&nbsp;<B>6 Month:</B> <!--#var 6_MONTH_AVG --> <INPUT type="radio" name="AVG_CALL_SPEND_BASIS" value="6M" language=javascript onclick="document.thisForm.HIGH_AVG.value='<!--#var 6_MONTH_AVG -->';"></TD>
<td></td>
</tr>
</table>










privacy (GDPR)