Topic - how to get selected value in pull down list
Topic - how to get selected value in pull down list Topic - how to get selected value in pull down list
from forum XML
 forum index   my profile   search 
 new topic  post reply 
moderators: pjr tab
how to get selected value in pull down list
Joined: 22-April-2007
Posts: 79
Location: Belgium
Posted: 19-June-2008 10:26
Here's the code ...

          <select name="assettype">
            <xsl:choose>
             <xsl:when test="assetkey">
              <option selected="selected"><xsl:value-of select="/nvp/assettype"/></option>
              <xrl:include href="xrl:get_assettypes.idoc"/>
             
             </xsl:when>
             <xsl:otherwise>
              <xrl:include href="xrl:get_assettypes.idoc"/>
             </xsl:otherwise>
            </xsl:choose>
           </select>


Now, the idea is that I display the allowed assettypes in a pull-down.
The get_assettypes.idoc gets those from the database, so far so good. However, in the case of an update, I want the option previously selected displayed as such. Again no problem, I add an "option selected".
And now the tricky part. I do not want that selected option displayed twice, so I wrote get_assettypes.idoc so it can take a parameter (assettype) to filter out values. For example :
http://localhost:1070/theplanone/testing/get_assettypes.idoc
Returns :
<nvp>
  <option>HWC</option>
  <option>CFG</option>
  <option>SW</option>
  <option>ASS</option>
</nvp>
http://localhost:1070/theplanone/testing/get_assettypes.idoc?assettype="ASS";
Returns :
<nvp>
  <option>HWC</option>
  <option>CFG</option>
  <option>SW</option>
</nvp>


And then I hit the problem ... how do pass the parameter inside the xrl:include statement ?

Long explanation for something simple probably ...
Hope someone can help,
Regards,
Tom
solved
Joined: 22-April-2007
Posts: 79
Location: Belgium
Posted: 20-June-2008 05:41
Got it ... some re-reading of the manuals was all it took ;-)
Here's the code after the change :

         <td>Assettype:</td>
         <td>
           <select name="assettype">
            <xsl:choose>
             <xsl:when test="assetkey">
              <option selected="selected"><xsl:value-of select="/nvp/assettype"/></option>
              <xrl:include href="xrl:get_assettypes.idoc">
               <nvp>
                <assettype>
                 "<xsl:value-of select="/nvp/assettype"/>"
                </assettype>
               </nvp>           
              </xrl:include>

             </xsl:when>
             <xsl:otherwise>
              <xrl:include href="xrl:get_assettypes.idoc"/>
             </xsl:otherwise>
            </xsl:choose>
           </select>
         </td>


And that's all there is to it, you can pass an inline document. There's probably a "nicer" solution in this case, but this is a working one ;-).

Regards,
Tom
 new topic  post reply  To find out about new replies to this post as they occur
please subscribe to one of these feeds:
AtomRSS moderate 
© 2003-2006, 1060 Research Limited. 1060 registered trademark, NetKernel trademark of 1060 Research Limited.