• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Interactive Forms

Interactive Forms 16 years 3 months ago #6235

Greetings,
I would like to add some script to my form so that the Thank You page comes back with text based on the answers to the form. I attempted to write some php on the Thank You page form
example:
<?php
$employee = \"{employname}\";
if($employee == \"Ms. Tanner\"){
echo \"Hello Ms. Tanner\";
} elseif($employee == \"Bob\"){
echo \"This is not Ms. Tanner!\";
}else {
echo \"You are an imposter\";
}
?>

This did not work as (I guess) PHP commands will not work within the Thank You page.

so I tryed using the script tab, the \"Script called on form process\" box and entered the above without the <?php ?> (as requested)

This did not work either.

So, upon request at support I added
if(isset($_POST))

This did not work either. I sent out an email back to support that, although this code seems to process, it does not result in text going to thank you page. I suspected that I needed something further in order to send the results to the thank you page. That was 6 hours or so ago with no response, so I am not sure if I am now being ignored, or if it is just not possible.

Any ideas??

Thanks!
The administrator has disabled public write access.

Re:Interactive Forms 16 years 3 months ago #6239

  • s31523
  • s31523's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 25
From what I can tell you will need to do this with hidden fields and utilizing the \"additional attributes\" field for you submit button.

For example, if you created a new field named \"dummy1\" and set its type to \"hidden\". You could then modify the \"additional attributes\" field of the submit button to something like:
onclick=\&quot;document.getElementById('dummy1').value = 'hello world';\&quot;

In the \"Thank You\" tab you could then add:

A message {dummy1}, which would display \"A message hello world\".

You could get elaborate utilizing java code. define a function by going to the \"form style\" tab and then added a javascript section directly after the end of the form definition, i.e.
&lt;script language=\&quot;javascript\&quot;&gt;
function doStuff (){
 ..... put your java code here ....
}
&lt;/script&gt;

once the function is defined you call it by adding onlick=\"doStuff();\" to the additional attributes of your submit button.

Good luck.
The administrator has disabled public write access.

Re:Interactive Forms 16 years 3 months ago #6240

Thanks for trying, but no joy.

See what I am trying to do is to make statements on the thank you page based on the answer given in the form
(see www.webxsposure.com/index.php?option=com_forme&fid=4 for the form)

So, per your example, I created a javascript to test just one form value (question 1) and placed in at the end of the font style

<script language=\"JavaScript\">

function doStuff() {

Var question = {question1};

//testing the value of question1

switch (question)
{
case \"Yes\" :
document.writeln(\"The answer is Yes\");
break;

case \"No\" :
document.writeln(\"The Answer is No\");
break;

default :
document.writeln(\"The Answer is Maybe\");
break;

}
}
</script>

Then, in the additional attributes of the submit button I placed

onlick=\"doStuff();\"

I filled out the form and nothing was written to the thank you page.

any other suggestions?
The administrator has disabled public write access.

Re:Interactive Forms 16 years 3 months ago #6241

Issue resolved.
The answer IS Javascript, but that javascript should be part of the Thank you page.
I had tried this before, but my mistake was to designate the code as
<script language=\"JavaScript\">

The solution was to also designate it as type text
<script language=\"JavaScript\" TYPE=\"TEXT/JAVASCRIPT\">

after that, all worked fine.

Thanks all!
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!