xsl-list
[Top] [All Lists]

call JavaScript when radio-button is checked

2004-09-15 16:03:13
When my webpage is displayed: if a particular Radio Button is already checked 
on ("Y"), then a specific text fields on the page should be disabled .  The xsl 
code works   fine when the user toggles the Radio Button.  The onclick 
attribute calls a JavaScript function that disables the text fields.   I need 
help figuring out how to call that JavaScript when the page loads or is 
refreshed.  How do I call that JavaScript when the page loads?   It is tricky 
because I have to check that the radio button is on and that another tag, 
provider_link_cu, is not blank.   
Below is my function and the sample radio button that calls the function 
"onclick".

    function disableTextField (obj)
     {
       <xsl:for-each select="dependent">
          obj.<xsl:value-of select="hlth_provider_idVarName"/>.disabled=true;
          obj.<xsl:value-of select="hlth_provider_idVarName"/>.value='';
          obj.pcp<xsl:value-of select="hlth_provider_idVarName"/>.disabled=true;
       </xsl:for-each>
     }

 <xsl:for-each select="radio">                     
     <xsl:element name="INPUT">
        <xsl:attribute name="TYPE">RADIO</xsl:attribute>
        <xsl:attribute name="NAME"><xsl:value-of select="name"/> 
</xsl:attribute>
       <xsl:attribute name="VALUE"><xsl:value-of 
select="value"/></xsl:attribute>
       <xsl:if test="checked='Y'">
           <xsl:attribute 
name="class">uportal-background-highlight</xsl:attribute>
           <xsl:attribute name="CHECKED">checked</xsl:attribute>
           <!--IF provider is blank, disable-->
           <xsl:if test="( ../provider_link_cu = ' ' ) ">
                   <xsl:attribute 
name="onClick">javascript:disableTextField(this.form )</xsl:attribute>
           </xsl:if>
       </xsl:if>
     </xsl:element>
</xsl:for-each> <!-- radio -->


<Prev in Thread] Current Thread [Next in Thread>