0

I have 3 radio button selection choices, and if the user selects the option "Forward" there is an input field for them to enter an email address. How can I make that input field required if they select the forward radio button? I can't seem to find any good information on XSLT required fields. The code is below:

<table cellpadding="0" id="allCategoryCheckboxes" >
    <tr id="categoryRows">
        <xsl:for-each select="form/categories/all/category">
            <xsl:sort data-type="number" order="ascending"
                     select="((value='Available') * 1) +
                             ((value='Unavailable') * 2) +
                            ((value='Forward') * 3)"/>
                 <td>
                    <input type="radio" name="catUid">
                      <xsl:attribute name="value"><xsl:value-of select="uid"/></xsl:attribute>
                      <xsl:if test="uid = ../../current//category/uid"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if>
                    </input>
                    <xsl:value-of select="value"/>
                    <xsl:if test="value = 'Forward'"> 
                       <xsl:text> to: </xsl:text>
                       <xsl:variable name="someEmailAddress">
                         <xsl:if test="/bedework/formElements/form/xproperties/node()[name()='X-FORWARDING-ADDRESS']">
                           <xsl:value-of select="/bedework/formElements/form/xproperties/node()[name()='X-FORWARDING-ADDRESS']/values/text"/>
                         </xsl:if>          
                       </xsl:variable>
                      <input type="text" name="someEmailForwardingAddress" value="{$someEmailAddress}" id="someEmailForwardingAddress"/>
                    </xsl:if>
                </td>
         </xsl:for-each>
    </tr>
</table>
patient957
  • 336
  • 4
  • 12
  • 4
    XSLT is merely a tool that is being used to transform some input XML to XHTML. Making a field "required" is in the scope of the browser and the generated XHTML, so the answer will require that you figure out what you want your XHTML to do, then ensuring that you generate it. – Jim Garrison Jun 28 '13 at 22:28
  • Thank you for the comment. XSLT has been difficult to understand/learn for me, so I realize this was probably not a very good question. Do you know of good resources for working in XSLT? I generally don't use it, I am just stuck with it for a particular project. – patient957 Jun 28 '13 at 22:37
  • 2
    I think the real question is what you mean by "required". Where is the UI running (browser? desktop?), and what behavior you want (error message? cursor can't leave field? color change? etc). When you know that, the next question is how to accomplish that in the system that is executing the UI. XSLT is not involved at that point. – Jim Garrison Jun 28 '13 at 22:45

0 Answers0