Jump to content

Using radio buttons to load another .xsl file


drewc

This topic is 6974 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I have a Filemaker 6 CDML solution which I am trying to convert to xsl. Everything goes all right until I come to the page where there is a choice of 3 pages using radio buttons. On the previous page, user has logged in using username & password and this value has been passed to this page ok. The code I am trying to use for the radio buttons is as follows:

........usual header stuff

form method="post" xsl:attribute name="action"FMPro xsl:attribute

input type="hidden" name="-db" value="mydatabase"

input type="hidden" name="-lay" value="mylayout"

input type="hidden" name="-recid" value="{$default-record/@record-id}"

.............

input type="radio" xsl:attribute name="action" /fmi/xsl/test3/p2.xsl

View Page 2

.............

choice 2

choice 3

.............

input type="submit" name="-find" value="GO"

.............etc.

After making the choice and clicking on 'GO' a file not found error is generated.

I need the current record-id to be passed to the chosen page, so I can't use the URL for the file.

Any help would be gratefuuly appreciated.

Link to comment
Share on other sites

There are several mistakes in your code.

- in FMS7A CWP, the action attribute can't be FMPro, it must be a XSLT file (e.g. action="/fmi/xsl/something.xsl") or a XML query (e.g. action="/fmi/xml/fmresultset.xml"

- you don't need the xsl:attribute tag as long as the content of the attribute is not dynamic. E.g. a simple <form method="post" action="youractionhere"> would do

- <input type="radio" can not have an action as attribute, only a name/value pair. See the HTML specification.

- if you want to post to different form actions upon selection of your radio button, you need JavaScript/DOM to achieve that. Then your action in the form tag must be empty and a JavaScript would set it and submit the form.

This would be an example (not tested by me, so please report mistakes):


<script language="JavaScript" type="text/javascript">

<xsl:comment>

<xsl:text disable-output-escaping="yes">

function gotopage() {

  if (document.myvariableform.actiontype[0].checked == true) {

    document.myvariableform.action = &quot;page1.xsl&quot;;

    document.myvariableform.submit();

    return true;

  } else if (document.myvariable.actiontype[1].checked == true) {

    document.myvariableform.action = &quot;page1.xsl&quot;;

    document.myvariableform.submit();

    return true;

  } else {

    alert(&quot;Please make a choice&quot;);

    return false;

  }

}

</xsl:text>

</xsl:comment>

</script>



<form method="post" name="myvariableform" action="">

<!-- add other required tags here -->

<input type="radio" name="actiontype" value="1"/><xsl:text>goto page1<xsl:text>

<input type="radio" name="actiontype" value="2"/><xsl:text>goto page2</text>

<input type="button" value="Go" onClick="return gotopage()"/>

</form>

Link to comment
Share on other sites

This topic is 6974 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.