Answered This has plagued me forever. Embedded SpeedScript woes.

Cecil

19+ years progress programming and still learning.
This is something that has plagued me forever since I've started using WebSpeed. I have never been able to using Embedded SpeedScript of an element to be able to output an attribute. What am I doing wrong?

Here is a simple snippet of HTML/SpeedScript code that I have never quite understand why it will not compile .

Code:
<div>
            <select  name="SiteGUID">
            <!--WSS FOR EACH ttSite:-->
                <option <!--WSS IF ttSite.SiteGUID EQ get-value('SiteGUID') THEN {&OUT} 'selected="selected"'. --> value="`ttSite.SiteGUID`"> `html-encode(ttSite.SiteName)` </option>
            <!--WSS END. -->
            </select>
        </div>

ERROR:** Unable to understand after -- " value="". (247)

My current working solution:

Code:
<div>
            <select  name="SiteGUID">
            <!--WSS FOR EACH ttSite:-->
                <!--WSS IF ttSite.SiteGUID EQ get-value('SiteGUID') THEN -->
                <option selected="selected" value="`ttSite.SiteGUID`"> `html-encode(ttSite.SiteName)` </option>
                <!--WSS ELSE -->
                <option  value="`ttSite.SiteGUID`"> `html-encode(ttSite.SiteName)` </option>

            </select>
        </div>
 

lee.bourne

Member
This is something that has plagued me forever since I've started using WebSpeed. I have never been able to using Embedded SpeedScript of an element to be able to output an attribute. What am I doing wrong?

Here is a simple snippet of HTML/SpeedScript code that I have never quite understand why it will not compile .

Code:
<div>
            <select  name="SiteGUID">
            <!--WSS FOR EACH ttSite:-->
                <option <!--WSS IF ttSite.SiteGUID EQ get-value('SiteGUID') THEN {&OUT} 'selected="selected"'. --> value="`ttSite.SiteGUID`"> `html-encode(ttSite.SiteName)` </option>
            <!--WSS END. -->
            </select>
        </div>

ERROR:** Unable to understand after -- " value="". (247)

My current working solution:

Code:
<div>
            <select  name="SiteGUID">
            <!--WSS FOR EACH ttSite:-->
                <!--WSS IF ttSite.SiteGUID EQ get-value('SiteGUID') THEN -->
                <option selected="selected" value="`ttSite.SiteGUID`"> `html-encode(ttSite.SiteName)` </option>
                <!--WSS ELSE -->
                <option  value="`ttSite.SiteGUID`"> `html-encode(ttSite.SiteName)` </option>
 
            </select>
        </div>

You're going to kick yourself if this works..... Just remove the full stop (period) between "selected"' and --> value

Lee
 

Cecil

19+ years progress programming and still learning.
Nice try. The code will definitely compile. BUT the HTML screws up.


Code:
<select name="SiteGUID">
<!--WSS FOR EACH ttSite:-->
<option <!--WSS IF ttSite.SiteGUID EQ TRIM(get-value('SiteGUID')) THEN {&OUT} 'selected="selected"'--> value="<%=ttSite.SiteGUID%>"> <%=html-encode(ttSite.SiteName)%> </option>
<!--WSS END. -->
</select>

Generated HTML CODE:

Code:
<select name="SiteGUID">
<option value="eb5bd485-c73c-0a81-e211-20b9822c3405" selected="selected" <option=""> AmBank </option>
<option select="" <="" <option=""></option>
</select>
 

Cecil

19+ years progress programming and still learning.
I found a better method of injecting strings into HTML:

Code:
<select name="SiteGUID">
<!--WSS FOR EACH ttSite:-->
<option <%=STRING( ttSite.SiteGUID EQ TRIM(get-value('SiteGUID') ),'selected="selected"')%> value="<%=ttSite.SiteGUID%>"> <%=html-encode(ttSite.SiteName)%> </option>
<!--WSS END. -->
</select>
 
Top