Apologies for not having done my homework, but I thought I would field a
quick question.
I haven't been working on this project for sometime, so I would have to get
back into it.

I am using Xerces 2.5.0.
I believe I am using Xalan 1.8.0, not sure how to check since the directory
name I unzipped does not have the version # in it.

At least with earlier versions, when I attempted to add some JavaScript
validation to my XSL, I received parse errors.

Here is a simple example that I did:

    <xsl:template name="CENTER_DATA">
        <!-- Replace the following part with your logic, the sample code
shows one record only! -->
        <!--
        <SCRIPT LANGUAGE="JavaScript">

          function runSubmit (form,button) {
            if (!check(form)) return;
            document.Group.submit();
            return;
          }

          function check(form) {
            result = true
            //If a player is selected from the list OR a handicap index is
entered
            //make sure a course is selected OR a course slope is provided.
            //For ALL players
            if ( ((form.p1hi.value.length > 0) || (form.p1DBhi.selectedIndex
> 0)) && (result) ) {
              if ( (form.p1sl.value.length == 0) && (form.ck.selectedIndex
== 0) ) {
                alert ("Must enter a course slope for Player 1.");
                form.p1sl.focus();
                result = false;
              }
            }

            return( result );
          }
        </SCRIPT>
        -->

        <FORM ACTION="group_handicap_display" NAME="log" METHOD="GET">

          <table>
            <tr>
              <td align="center">
                <H2>Group Handicap Calculator</H2>
              </td>
            </tr>
            <tr>
              <!--table borderColor='#ffe4b5' border='2'-->
              <table border='2'>
                  <th></th>
                  <th>Player 1</th>
                  <th>Player 2</th>
                  <th>Player 3</th>
                  <th>Player 4</th>
                <tr>
                  <td>Player:</td>
                  <td>
                    <SELECT NAME="pk1">
                      <xsl:for-each select="DATA/player" >
                        <OPTION VALUE="{player.player_key}">
                          <xsl:value-of select="player.player_name" />
                        </OPTION>
                      </xsl:for-each>
                    </SELECT>
                  </td>
                  <td>
                    <SELECT NAME="pk2">
                      <xsl:for-each select="DATA/player" >
                        <OPTION VALUE="{player.player_key}">
                          <xsl:value-of select="player.player_name" />
                        </OPTION>
                      </xsl:for-each>
                    </SELECT>
                  </td>
                  <td>
                    <SELECT NAME="pk3">
                      <xsl:for-each select="DATA/player" >
                        <OPTION VALUE="{player.player_key}">
                          <xsl:value-of select="player.player_name" />
                        </OPTION>
                      </xsl:for-each>
                    </SELECT>
                  </td>
                  <td>
                    <SELECT NAME="pk4">
                      <xsl:for-each select="DATA/player" >
                        <OPTION VALUE="{player.player_key}">
                          <xsl:value-of select="player.player_name" />
                        </OPTION>
                      </xsl:for-each>
                    </SELECT>
                  </td>
                </tr>
                <tr>
                  <td>Course:</td>
                  <td colspan="4" align="center">
                    <SELECT NAME="ck">
                      <xsl:for-each select="DATA/course" >
                        <OPTION VALUE="{course.course_key}">
                          <xsl:value-of select="course.course" />
                        </OPTION>
                      </xsl:for-each>
                    </SELECT>
                  </td>
                </tr>
                <tr>
                  <td>Handicap Index:</td>
                  <td>
                    <INPUT TYPE="text" NAME="p1hi" SIZE="4" VALUE=""/>
                  </td>
                  <td>
                    <INPUT TYPE="text" NAME="p2hi" SIZE="4" VALUE=""/>
                  </td>
                  <td>
                    <INPUT TYPE="text" NAME="p3hi" SIZE="4" VALUE=""/>
                  </td>
                  <td>
                    <INPUT TYPE="text" NAME="p4hi" SIZE="4" VALUE=""/>
                  </td>
                </tr>
                <tr>
                  <td>Course Slope:</td>
                  <td>
                    <INPUT TYPE="text" NAME="p1sl" SIZE="4" VALUE=""/>
                  </td>
                  <td>
                    <INPUT TYPE="text" NAME="p2sl" SIZE="4" VALUE=""/>
                  </td>
                  <td>
                    <INPUT TYPE="text" NAME="p3sl" SIZE="4" VALUE=""/>
                  </td>
                  <td>
                    <INPUT TYPE="text" NAME="p4sl" SIZE="4" VALUE=""/>
                  </td>
                </tr>
                <tr>
                  <td>Name:</td>
                  <td>
                    <INPUT TYPE="text" NAME="p1name" SIZE="20" VALUE=""/>
                  </td>
                  <td>
                    <INPUT TYPE="text" NAME="p2name" SIZE="20" VALUE=""/>
                  </td>
                  <td>
                    <INPUT TYPE="text" NAME="p3name" SIZE="20" VALUE=""/>
                  </td>
                  <td>
                    <INPUT TYPE="text" NAME="p4name" SIZE="20" VALUE=""/>
                  </td>
                </tr>
                <tr>
                  <td align="center" colspan="5">
                    <!--input TYPE="submit" VALUE="Submit"
onClick="runSubmit(this.form, this)"/-->
                    <input TYPE="submit" VALUE="Submit" />
                  </td>
                </tr>
              </table>
              <H3>Choose a player OR enter a handicap index. </H3>
              <H3>Choose a course OR enter a course slope. </H3>
              <A HREF="main">Main Menu</A>
            </tr>
          </table>

        </FORM>

    </xsl:template>


If I uncomment the JavaScript section then the I get errors when trying to
use the page.
I dont have the error handy, but thought I would ask first to see if there
is something I am obviously doing wrong.

Thanks in advance for any help provided.

Dave

Reply via email to