Forums

Functions in Events from Element Settings

croonhb 03 Feb, 2015
For a client I am in the proces of making a surveyform. The most questings are in the form of a radiobox.
In the events from the Edit element settings there are different possibilities. Is there als a possibility to goto a page of the form, or even a page from the website.
For instance: = yes function: goto http://www.tao2success.com/registratie or
=yes function goto page 3

Hope this question is clear and that somebody can help me in this.
Regards

Huib Croon
GreyHead 04 Feb, 2015
Hi Huib,

Yes it is possible - in that you can call a JavaScript function that would do that. But sending the user somewhere else would take them away from your form page - is that what you intend
function onEventA() {
  window.location.replace('http://www.tao2success.com/registratie');
}

Bob
croonhb 04 Feb, 2015
Bob,

Thanks for the answer.
But I think I am doing something wrong, because it is not functioning.
This is the url of the form: http://tao2success.com/index.php?option=com_chronoforms5&chronoform=Enquete-Tao2Success-2

The syntax is as follows. If you select ja(yes) the next is shown wher the visitor can subscribe to one of the three workshops. If he selects one it is the intention that he is send to the page where he can register and that wil take him away from the form.

The second question was:

If he select nee(No) it is the intention that he is sent to page 2 where the different possibilities are given why he will not register.

Hope you can clarify this.

regards
Huib
GreyHead 05 Feb, 2015
Hi Huib,

It looks as though you have put the whole function in the Target Field ID box? Just the name of the function e.g. onEventA goes in there. The function itself goes into a Load JavaScript action.

Bob
croonhb 05 Feb, 2015
Hi Bob,

I think I am a little bit stupid, but seem to do someting completely wrong.
I put onEventA() in the events Targetfileld.
And onEventA() { window.location.replace('http://www.http://tao2success.com/registratie/registratie-managers');
}
In the load java script which I put as first in the onload of the form.

And the result is that the complete form is shown. In stead of only the first question.
See http://tao2success.com/index.php?option=com_chronoforms5&chronoform=Enquete-Tao2Success-2rev1

This is what it should be:
http://tao2success.com/index.php?option=com_chronoforms5&chronoform=Enquete-Tao2Success-2

Please advise

Huib
GreyHead 05 Feb, 2015
Hi Huib,

A small variation . . . please try this

+ put onEventA in the Target field box - with no brackets

+ put this in the Load Javascript action
function onEventA() {
  window.location.replace('http://www.http://tao2success.com/registratie/registratie-managers');
}
I added a missing 'function'

Bob
croonhb 06 Feb, 2015
Hi Bob,

Thanks for the effort, but I must disappoint you it is not functioning. But the form is now showing as expected.
I tried it also on a completely new form, to minimize the possibility of possible mistakes in the form, but on this form the same results.
May I have to figure out something else for this problem. But don’t know what at this moment.
And maybe it is true that one fool can ask more than one wise man can answer.
If you by any chance are willing to have a look at the administrator site of the website I am more than willing to send you the login data.
Anyhow once again thanks for your effort.

Regards
Huib
cappleby 18 Jun, 2015
Hi Bob,

I'm trying to do a similar thing to check on a credit card No.
I've added this custom Action ('Meio_Mask) in On Load:
<?php
JHtml::_('behavior.framework', true);
$doc =& JFactory::getDocument();
$url = JURI::root().'components/com_chronoforms5/extras/meio_mask/source/';
$doc->addScript($url.'Meio.Mask.js');
$doc->addScript($url.'Meio.Mask.Extras.js');
$doc->addScript($url.'Meio.Mask.Fixed.js');
$doc->addScript($url.'Meio.Mask.Regexp.js');
$doc->addScript($url.'Meio.Mask.Repeat.js');
$doc->addScript($url.'Meio.Mask.Reverse.js');
?>

I've then added a load js action to the start of On Submit:
function oncardno() {
window.addEvent('domready', function() {
  $('cardno').meiomask('Fixed', 'Cc');
})}; 
'cardno' is the field id of the credit card no but it isn't finding errors in the number of digits.
'cardno' is set to be a required field.
What am I doing wrong?
This topic is locked and no more replies can be posted.