[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

"form.submit" not working

Subject: "form.submit" not working
From: himanshu padmanabhi <himanshu.padmanabhi@xxxxxxxxx>
Date: Wed, 25 Feb 2009 11:40:54 +0530
 "form.submit" not working
"not worked" means form not submitted.HTML elements specified in XSL
got printed.I am using Firefox 3 Beta 5.Not script error,only problem
is cgi script is not called on form submit.

Equivalent HTML code works well.

print "<form name=\"form1\" method=\"POST\" action=\"one.cgi\">
    <tr>
        <td>
             <input type=\"text\" name=\"machine_ip1\" value=\"1\"></input>
        </td>
        <td>
             <input type=\"text\" name=\"machine_ip2\" value=\"2\"></input>
        </td>
        <td>
             <input type=\"text\" name=\"machine_ip3\" value=\"3\"></input>
        </td>
    </tr>
    </form>
    <script type=\"text/javascript\">
        document.form1.submit();
    </script>";

Similar XSL code also works well(submit works here)

<xsl:output method="html"/>

<xsl:template match="tracks">
    <table border="1">
        <tr>
            <td> Parameter </td>
            <td> Description </td>
            <td> Value </td>
        </tr>
        <xsl:apply-templates/>
    </table>
</xsl:template>

<xsl:template match="two">
    <form name="form1" method="POST" action="two.cgi">
    <tr>
        <td>
            <xsl:value-of select="label"/>
        </td>
        <td>
            <xsl:value-of select="desc"/>
        </td>
        <td>
             <xsl:if test="label = 'machine name'">
              <select>
                 <xsl:call-template name="str:tokenize">
                 </xsl:call-template>
             </select>
             </xsl:if>

             <xsl:if test="label = 'limit'">
             <input type="text" name="limit" value="">
             </input>
             </xsl:if>
        </td>
    </tr>
    </form>
     <script>
        document.form1.submit();
    </script>
</xsl:template>

<!-- ONLY STR:TOKENIZE IS DIFFERENT HERE -->
<xsl:template name="str:tokenize">
    <xsl:param name="args" select="$args" />
    <xsl:param name="delimiters" select="' &#x9;&#xA;'" />
    <xsl:choose>

    <xsl:when test="not($args)" />
    <xsl:when test="not($delimiters)">
        <xsl:call-template name="str:_tokenize-characters">
            <xsl:with-param name="args" select="$args" />
        </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
        <xsl:call-template name="str:_tokenize-delimiters">
            <xsl:with-param name="args" select="$args" />
            <xsl:with-param name="delimiters" select="$delimiters" />
        </xsl:call-template>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<xsl:template name="str:_tokenize-characters">
    <xsl:param name="args" />
    <xsl:if test="$args">
        <token><xsl:value-of select="substring($args, 1, 1)" /></token>
        <xsl:call-template name="str:_tokenize-characters">
            <xsl:with-param name="args" select="substring($args, 2)" />
        </xsl:call-template>
    </xsl:if>
</xsl:template>

<xsl:template name="str:_tokenize-delimiters">
  <xsl:param name="args" />
  <xsl:param name="delimiters" />
  <xsl:variable name="delimiter" select="substring($delimiters, 1, 1)" />
  <xsl:choose>
    <xsl:when test="not($delimiter)" >
          <option><xsl:value-of select="$args" /></option>
    </xsl:when>
    <xsl:when test="contains($args, $delimiter)">
        <xsl:if test="not(starts-with($args, $delimiter))">
            <xsl:call-template name="str:_tokenize-delimiters">
                <xsl:with-param name="args"
select="substring-before($args, $delimiter)" />
                <xsl:with-param name="delimiters"
select="substring($delimiters, 2)" />
            </xsl:call-template>
        </xsl:if>
        <xsl:call-template name="str:_tokenize-delimiters">
            <xsl:with-param name="args" select="substring-after($args,
$delimiter)" />
            <xsl:with-param name="delimiters" select="$delimiters" />
        </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
        <xsl:call-template name="str:_tokenize-delimiters">
            <xsl:with-param name="args" select="$args" />
            <xsl:with-param name="delimiters"
select="substring($delimiters, 2)" />
        </xsl:call-template>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

</xsl:stylesheet>

Just don't know now,what is going wrong.other HTML form elements gets
printed,only form.submit isnt working..:(

Regards,
Himanshu


On Tue, Feb 24, 2009 at 7:30 PM, Martin Honnen <Martin.Honnen@xxxxxx> wrote:
>
> himanshu padmanabhi wrote:
>>
>> This is my one.cgi which should be called on xsl submit
>>
>> #!/usr/bin/perl
>
> You will need to discuss your Perl code on a Perl forum.
>
>> HTML elements gets printed correctly in my given code also and submit
>> code given by Mr. Martin not worked(sorry,maybe I did something
>> wrong)..:((
>
> What exactly happens when you say "not worked"? Which browser do you use? Do
you get a script error?
> Does the submit code work in a static HTML document but not in the HTML
generated by the stylesheet? In that case at least it could require a fix to
the stylesheet which would be on topic here.
>
>
> --
>
>        Martin Honnen
>        http://JavaScript.FAQTs.com/
>



--
Regards,
Himanshu Padmanabhi




--
Regards,
Himanshu Padmanabhi

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.