Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Virgin XSL User. Need to pass value and ID into ASP script 1

Status
Not open for further replies.

Claypole

Programmer
Aug 22, 2002
12
0
0
GB
<xsl:template name=&quot;position&quot;>
<select class=&quot;sys_text&quot; name=&quot;position&quot;>
<option value=&quot;none&quot;>(select)</option>
<xsl:for-each select=&quot;root/position/item&quot;>
<option>
<xsl:attribute name=&quot;value&quot;><xsl:value-of select=&quot;@value&quot;/></xsl:attribute>
<xsl:value-of select=&quot;@value&quot;/>
</option>
</xsl:for-each>
</select>
</xsl:template>

This is the XSL what I need to do is pass the ID aswell as the value back to my ASP script. At the moment it passes the value only. I'm trying to extend someone's code who has left the company.
All help gratefully received. The template is of the form
ID Value where only Value is displayed in the select DRop Down List.
 
The simplest way I see to do this is to pass them both in the value and split them on the ASP page, they will be in the format ID,Value in the Request.Form on the next page.

XSL:
Code:
<xsl:template name=&quot;position&quot;>
    <select class=&quot;sys_text&quot; name=&quot;position&quot;>
      <option value=&quot;none&quot;>(select)</option>
      <xsl:for-each select=&quot;root/position/item&quot;>
        <option>
          <xsl:attribute name=&quot;value&quot;><xsl:value-of select=&quot;@id&quot;/>,<xsl:value-of select=&quot;@value&quot;/></xsl:attribute>
          <xsl:value-of select=&quot;@value&quot;/>          
        </option>
      </xsl:for-each>
    </select>
    </xsl:template>

ASP:
Code:
Dim varId, varValue, both
'split the comma delimited  contents into 2 element array
both = split(Request.Form(&quot;position&quot;),&quot;,&quot;)

'put the contents in the correct variables
varId = both(0)
varValue = both(1)

That is one way to di, probably the easiest as it requires no client scripting but keeps the id and value pair together. The XSL is assuming that the id is an attribute just like the value.

-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top