Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
West Wind Connect - Problem ComboBox vs Template files
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00397786
Message ID:
00397837
Views:
12
You can't use Response.Write in templates, only in scripts. Templates are evaluated and the Response object refers to the main output stream that the
entire result document is fed into. This would result in any Response output going in front of the document.

You can do it in script code, because the Response object is overlooaded for use in the script page there. You can SCAN trhough the document as needed like this:
< SELECT name="cmbCombo">

< % 
select key, caption from Lookups where type = "lookup" into cursor TQuery

SCAN
% >
< OPTION value="< %= TQuery.key % >" >< %= Tquery.Caption % >
<% ENDSCAN %>

< /SELECT >
In a template, you can't use this syntax because compound statements can't be split up. But you can do this:

< %
lcOutput = ""
select key, caption from Lookups where type = "lookup" into cursor TQuery

SCAN
lcOutput = lcOutput + [< OPTION value="] + TQuery.key + ;
[" >] + Tquery.Caption

ENDSCAN

lcOutput = lcOutput + "< /select >"
RETURN lcOutput
% >

Here you're using a codeblock and the return value is embedded into the document. You could also use a UDF():

< %= GenerateList() % >

or an object. In fact, for generating combo boxes look into the wwDBFPopup object which generates the popup with a few property settings.


+++ Rick ---

>Hi!
>
>My codes seem not to be a problem when it's running but when I need a dynamic combobox (I generate the combobox with a SCAN and a cursor) in my web page, I have to put response.write command for all DHTML code lines to retreive Option value marker under the Select marker relative of the combobox. Otherwise the Option value markers appears on the top of the DHTML code (before de HEAD marker).
>
>Is there another best way to evitate to use many response.write commands and keep the order of my code when I do view source ?
>
>(I tried to send an example code but too many special caracters prevent me to go on)
>
>Regards
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform