Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Dear All
I have following code. Please guide me how to get selected value of DropDown List.
<select name="Month" id="Month" > <option value="0">Please Choose</option> <xsl:call-template name="for.loop"> <xsl:with-param name="i">1</xsl:with-param> <xsl:with-param name="count">12</xsl:with-param> </xsl:call-template> </select>
<option value="0">Please Choose</option> <xsl:if test="count($items) > 0"> <xsl:for-each select="$items/DateFolder"> <xsl:sort select="@nodeName" order="descending" /> <option value="{@nodeName}" > <xsl:value-of select="@nodeName" /> </option> </xsl:for-each> </xsl:if> </select>
Please help.
Regards
Muhammad Shahnawaz
skype: muhammadshahnawaz
Do you need to get the selected value in xslt? If so, use
<xsl:value-of select="umbraco.library:RequestForm('Month')" />
where 'Month' is the id of the select html control
Cheers,
/Dirk
@Dirk
dont return me anything. :(
Do you have a form on your template?
Following is my Whole Code
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:msxml="urn:schemas-microsoft-com:xslt"xmlns:msxsl="urn:schemas-microsoft-com:xslt"xmlns:math="http://exslt.org/math"xmlns:umbraco.library="urn:umbraco.library"xmlns:yourprefix="urn:my-scripts"exclude-result-prefixes="msxml yourprefix umbraco.library"><xsl:output method="html" omit-xml-declaration="yes"/><xsl:param name="currentPage"/><msxsl:script implements-prefix='yourprefix' language='CSharp'><![CDATA[public string monthName(int monthNum){DateTime date = new DateTime(1,monthNum,1);return date.ToString("MMMM");}]]></msxsl:script> <xsl:variable name="items" select="$currentPage/ancestor-or-self::* [@level > $minLevel and string(umbracoNaviHide) != '1'] "/><xsl:variable name="minLevel" select="1"/><xsl:template match="/"> <div> <div style="float:left; width: 50px;"> Year: </div> <div style="float:left; width: 100px;"> <select name="year" id="year" > <option value="0">Please Choose</option> <xsl:if test="count($items) > 0"> <xsl:for-each select="$items/DateFolder"> <xsl:sort select="@nodeName" order="descending" /> <option value="{@nodeName}" > <xsl:value-of select="@nodeName" /> </option> </xsl:for-each> </xsl:if> </select> </div> <div style="float:left; width: 50px;"> </div> <div style="float:left; width: 50px;"> Month: </div> <div style="float:left;width:100px;"> <select name="Month" id="Month" > <option value="0">Please Choose</option> <xsl:call-template name="for.loop"> <xsl:with-param name="i">1</xsl:with-param> <xsl:with-param name="count">12</xsl:with-param> </xsl:call-template> </select> </div> <div style="float:left; width: 50px;"> </div> <xsl:variable name="monthNumber" select="umbraco.library:RequestForm('Month')" /> <xsl:value-of select="$monthNumber" /> <div style="float:left;width:100px;"> <a href="?page={number($monthNumber)}">Show</a> </div> </div> <br/> </xsl:template> <xsl:template name="for.loop"> <xsl:param name="i"/> <xsl:param name="count" /> <xsl:if test="$i <= $count"> <option value="{$i}" > <xsl:value-of select="yourprefix:monthName(number($i))"/></option> </xsl:if> <xsl:if test="$i <= $count"> <xsl:call-template name="for.loop"> <xsl:with-param name="i"> <xsl:value-of select="$i + 1"/> </xsl:with-param> <xsl:with-param name="count"> <xsl:value-of select="$count"/> </xsl:with-param> </xsl:call-template> </xsl:if> </xsl:template> </xsl:stylesheet>
I am using Form Tag in Content Page where i am using my all modules, macros and content
Any Help Guys?
Is it possible to get selected value of HTML Dropdown from XSLT? I cant find any help online. It has been more than a week
Hi Shahnawaz,
I am also having the same problem that you are having. i just found out a link which might be helpful to you.If you have already solved that issue, can you please provide me the working code.
http://www.mortenbock.dk/blog/2007/02/08/using-xslt-search-with-multiple-dropdowns.aspx
Regards,
Bobby
Hey,
You can just us umbraco.library:Request('yourValue') in XSLT
Rich
Just to be clear, getting this value in XSLT is not tricky, if it's not working then it's probably something to do withyour form.
Essentially this works the same as any html form (have you named your dropdown element as well as given it an ID?)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to Get Selected Value of DropDown
Dear All
I have following code. Please guide me how to get selected value of DropDown List.
<select name="Month" id="Month" >
<option value="0">Please Choose</option>
<xsl:call-template name="for.loop">
<xsl:with-param name="i">1</xsl:with-param>
<xsl:with-param name="count">12</xsl:with-param>
</xsl:call-template>
</select>
<option value="0">Please Choose</option>
<xsl:if test="count($items) > 0">
<xsl:for-each select="$items/DateFolder">
<xsl:sort select="@nodeName" order="descending" />
<option value="{@nodeName}" >
<xsl:value-of select="@nodeName" />
</option>
</xsl:for-each>
</xsl:if>
</select>
Please help.
Regards
Muhammad Shahnawaz
skype: muhammadshahnawaz
Do you need to get the selected value in xslt? If so, use
where 'Month' is the id of the select html control
Cheers,
/Dirk
@Dirk
dont return me anything. :(
Do you have a form on your template?
Cheers,
/Dirk
Following is my Whole Code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:math="http://exslt.org/math"
xmlns:umbraco.library="urn:umbraco.library"
xmlns:yourprefix="urn:my-scripts"
exclude-result-prefixes="msxml yourprefix umbraco.library">
<xsl:output method="html" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<msxsl:script implements-prefix='yourprefix' language='CSharp'>
<![CDATA[
public string monthName(int monthNum)
{
DateTime date = new DateTime(1,monthNum,1);
return date.ToString("MMMM");
}
]]>
</msxsl:script>
<xsl:variable name="items" select="$currentPage/ancestor-or-self::* [@level > $minLevel and string(umbracoNaviHide) != '1'] "/>
<xsl:variable name="minLevel" select="1"/>
<xsl:template match="/">
<div>
<div style="float:left; width: 50px;">
Year:
</div>
<div style="float:left; width: 100px;">
<select name="year" id="year" >
<option value="0">Please Choose</option>
<xsl:if test="count($items) > 0">
<xsl:for-each select="$items/DateFolder">
<xsl:sort select="@nodeName" order="descending" />
<option value="{@nodeName}" >
<xsl:value-of select="@nodeName" />
</option>
</xsl:for-each>
</xsl:if>
</select>
</div>
<div style="float:left; width: 50px;">
</div>
<div style="float:left; width: 50px;">
Month:
</div>
<div style="float:left;width:100px;">
<select name="Month" id="Month" >
<option value="0">Please Choose</option>
<xsl:call-template name="for.loop">
<xsl:with-param name="i">1</xsl:with-param>
<xsl:with-param name="count">12</xsl:with-param>
</xsl:call-template>
</select>
</div>
<div style="float:left; width: 50px;">
</div>
<xsl:variable name="monthNumber" select="umbraco.library:RequestForm('Month')" />
<xsl:value-of select="$monthNumber" />
<div style="float:left;width:100px;">
<a href="?page={number($monthNumber)}">Show</a>
</div>
</div>
<br/>
</xsl:template>
<xsl:template name="for.loop">
<xsl:param name="i"/>
<xsl:param name="count" />
<xsl:if test="$i <= $count">
<option value="{$i}" >
<xsl:value-of select="yourprefix:monthName(number($i))"/></option>
</xsl:if>
<xsl:if test="$i <= $count">
<xsl:call-template name="for.loop">
<xsl:with-param name="i">
<xsl:value-of select="$i + 1"/>
</xsl:with-param>
<xsl:with-param name="count">
<xsl:value-of select="$count"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
I am using Form Tag in Content Page where i am using my all modules, macros and content
Any Help Guys?
Is it possible to get selected value of HTML Dropdown from XSLT? I cant find any help online. It has been more than a week
Is it possible to get selected value of HTML Dropdown from XSLT? I cant find any help online. It has been more than a week
Hi Shahnawaz,
I am also having the same problem that you are having. i just found out a link which might be helpful to you.If you have already solved that issue, can you please provide me the working code.
http://www.mortenbock.dk/blog/2007/02/08/using-xslt-search-with-multiple-dropdowns.aspx
Regards,
Bobby
Hey,
You can just us umbraco.library:Request('yourValue') in XSLT
Rich
Just to be clear, getting this value in XSLT is not tricky, if it's not working then it's probably something to do withyour form.
Essentially this works the same as any html form (have you named your dropdown element as well as given it an ID?)
Rich
is working on a reply...