Re: [xsl] call JavaScript when radio-button is checked

Subject: Re: [xsl] call JavaScript when radio-button is checked
From: Josh Canfield <joshcanfield@xxxxxxxxx>
Date: Wed, 15 Sep 2004 16:43:30 -0700
This is really a JavaScript question, which would be better suited for
a JavaScript forum, not an XSL forum.

you might want to start with your generated HTML/JavaScript, determine
what the correct HTML/JavaScript is, then move it into your XSL, it's
easier to debug that way as you don't have to keep regenerating the
file.

Have you looked at the onLoad attribute of the body element?

Josh

On Wed, 15 Sep 2004 17:03:13 -0600, Laura Madonna
<laura.madonna@xxxxxxxxx> wrote:
> 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 -->

Current Thread