after the submit action?
In my form, on submit, I save datas into database and redirect the user to the page where he come from before the Form.
I would like to display temporary a message as: "Thank you for registration, you will receive a confirming e-mail" and then redirect (after 5 sec.) to another page.
Thanks to help me.
Jérôme
In my form, on submit, I save datas into database and redirect the user to the page where he come from before the Form.
I would like to display temporary a message as: "Thank you for registration, you will receive a confirming e-mail" and then redirect (after 5 sec.) to another page.
Thanks to help me.
Jérôme
Hi Jerome,
This would probably be easiest achieved using a tiny javascript:
OnSubmit after email:
Edit: Fixed minor typo breaking the code.
/Fredrik
This would probably be easiest achieved using a tiny javascript:
OnSubmit after email:
<?
JHTML::_('behavior.mootools');
$doc =& JFactory::getDocument();
$script = "window.addEvent('domready', function() {
setTimeout('window.location=\'http://www.thenewurl.tld/path/to/file\'', 5000);
});";
$doc->addScriptDeclaration($script);
?>
Edit: Fixed minor typo breaking the code.
/Fredrik
Hi Fredrik
I put this code in 'Form Code'-->'onSubmit Events Code'-->'On Submit code - after sending email'
as you told me... but it's do anything!
Do I made a mistake on the place to put this code?
Or I have to active something else?
Regards
Jérôme
I put this code in 'Form Code'-->'onSubmit Events Code'-->'On Submit code - after sending email'
as you told me... but it's do anything!
Do I made a mistake on the place to put this code?
Or I have to active something else?
Regards
Jérôme
Hi Jerome,
Actually, I managed to screw up with that code. There's a single ' missing at the end of the first argument for setTimeout(), I'll update my initial post in a moment..
/Fredrik
Actually, I managed to screw up with that code. There's a single ' missing at the end of the first argument for setTimeout(), I'll update my initial post in a moment..
/Fredrik
Morning Fedrik
I change my code with your correction but it still not work😟
In my new url, can i declare any valid url? for test, i put the simple //www.jum31.fr/test/remerciement_inscription.html
my form is here: http://www.jum31.fr/test/index.php?option=com_chronocontact&chronoformname=Inscription_BAK
i don't understand what's wrong.
Jérôme
I change my code with your correction but it still not work😟
In my new url, can i declare any valid url? for test, i put the simple //www.jum31.fr/test/remerciement_inscription.html
my form is here: http://www.jum31.fr/test/index.php?option=com_chronocontact&chronoformname=Inscription_BAK
i don't understand what's wrong.
Jérôme
G'day Jerome,
Any valid URL should do. Keep in mind that a valid URL must also contain a protocol specifier, that's why we start it with 'http://'.
I did a test-submission, and it would appear the JS-code was not included in the page at all, which I find puzzling. I did however, end up on an article-page. Could you check that the "General->Form URLs->REdirect URL" setting is empty?
/Fredrik
Any valid URL should do. Keep in mind that a valid URL must also contain a protocol specifier, that's why we start it with 'http://'.
I did a test-submission, and it would appear the JS-code was not included in the page at all, which I find puzzling. I did however, end up on an article-page. Could you check that the "General->Form URLs->REdirect URL" setting is empty?
/Fredrik
Hi
in the "General->Form URLs->REdirect URL", i had set the redirect url "http://www.jum31.fr/test/index.php?option=com_content&view=article&id=56&Itemid=65" because i would like to return to this page after the display of the "validation message". Maybe i misunderstood what your code make.
So I set nothing in the "General->Form URLs->REdirect URL" and then i put the "http://www.jum31.fr/test/index.php?option=com_content&view=article&id=56&Itemid=65" url in your code and now, at the submission, i have for 5 sec. the page "http://www.jum31.fr/test/index.php?option=com_chronocontact&chronoformname=Inscription_BAK" without the form (none information) and then i am redirect to the article from which i came.
this working seems fine but i would like to had a message like "thank you to register to this conf." on the 5 sec. displayed page.
i'm not sure to be clear when i read what i write above
Jérôme
in the "General->Form URLs->REdirect URL", i had set the redirect url "http://www.jum31.fr/test/index.php?option=com_content&view=article&id=56&Itemid=65" because i would like to return to this page after the display of the "validation message". Maybe i misunderstood what your code make.
So I set nothing in the "General->Form URLs->REdirect URL" and then i put the "http://www.jum31.fr/test/index.php?option=com_content&view=article&id=56&Itemid=65" url in your code and now, at the submission, i have for 5 sec. the page "http://www.jum31.fr/test/index.php?option=com_chronocontact&chronoformname=Inscription_BAK" without the form (none information) and then i am redirect to the article from which i came.
this working seems fine but i would like to had a message like "thank you to register to this conf." on the 5 sec. displayed page.
i'm not sure to be clear when i read what i write above
Jérôme
G'day,
Moving the URL into the code is correct.
In order to add a "Thank You"-note, simply write the HTML-code (excluding <html>, <body> and such) after the ?>
Something like this:
Of course, you don't need to use the <div> or the message CSS-class. Just a simple example on how you could style your custom thank you page.
/Fredrik
Moving the URL into the code is correct.
In order to add a "Thank You"-note, simply write the HTML-code (excluding <html>, <body> and such) after the ?>
Something like this:
<?
/* JS-code here... */
?>
<div class="message">Thank you for registering to this Conference. You will shortly be redirected to <a href="http://www.jum31.fr/test/index.php?option=com_content&view=article&id=56&Itemid=65" alt="Conférence de M. Fabrice BAK">Conférence de M. Fabrice BAK</a>.<br />Please use the link above if you are not automatically redirected.</div>
Of course, you don't need to use the <div> or the message CSS-class. Just a simple example on how you could style your custom thank you page.
/Fredrik
Yessssss !!!!!!!!!
Great, the message is well displayed.
thank you very much for all.
I have 1 or 2 others questions, if i would dare...
I dare :mrgreen:
In this form, there is no control on existing e-mail, so, if a person register again with the same e-mail, there is no error message. Do i have to pass by a javascript or php script?
The second problem is that i would like to have a dynamic form:
"Depart. adhésion" and "Num adhérent" fields would be displayed only when "Adhérent Jumeaux et Plus" item is selected in "Qualité" choice.
Jérôme
Great, the message is well displayed.
thank you very much for all.
I have 1 or 2 others questions, if i would dare...
I dare :mrgreen:
In this form, there is no control on existing e-mail, so, if a person register again with the same e-mail, there is no error message. Do i have to pass by a javascript or php script?
The second problem is that i would like to have a dynamic form:
"Depart. adhésion" and "Num adhérent" fields would be displayed only when "Adhérent Jumeaux et Plus" item is selected in "Qualité" choice.
Jérôme
Well,
There are some ways of checking this... The first requirement however, is that you enable the DB storage, so that we have a database of email addresses to search for. If this is not already enabled, I believe you'll find some information on this spread through the forum and/or the guides. Otherwise, the process isn't that difficult using the "Create Database" wizard..
Once you've got the DB-storage set up, all we need to do is execute a simple SQL-query and test the result.
Server-side Validation:
/Fredrik
There are some ways of checking this... The first requirement however, is that you enable the DB storage, so that we have a database of email addresses to search for. If this is not already enabled, I believe you'll find some information on this spread through the forum and/or the guides. Otherwise, the process isn't that difficult using the "Create Database" wizard..
Once you've got the DB-storage set up, all we need to do is execute a simple SQL-query and test the result.
Server-side Validation:
<?
$db =& JFactory::getDBO();
$query = sprintf('SELECT COUNT(*) FROM %s WHERE %s = %s',
$db->nameQuote('jos_myregisteredtable'),
$db->nameQuote('email'),
$db->Quote(JRequest::getString('email', ''))
);
$db->setQuery($query);
if ($db->loadResult() != 0 || JRequest::getString('email', '') == '') {
return 'Sorry, but you have already registered for this Conference. You cannot register again using the same email address.';
}
?>
/Fredrik
That's work well, good.
I think it is normal that the form is cleared after the error message and all informations have to been typed again?
No idea for the dynamic form?
Promise, it's the last question 😶
I think it is normal that the form is cleared after the error message and all informations have to been typed again?
No idea for the dynamic form?
Promise, it's the last question 😶
Hi Jérôme,
In the Form General Tab set "Republish fields if error occured" to 'Tryto Republish'
Bob
In the Form General Tab set "Republish fields if error occured" to 'Tryto Republish'
Bob
There is an option to tell CF to try and republish the form data. There are, however, some cases where this does not work for some reason or other. You'll find this setting on the General tab under "Other Form Settings". Be advised that this might very well break when generating dynamic forms...
As for Dynamic Forms, I believe the simplest approach would be a tiny JScript that toggles the visibility property of a container (<div> or such) or the object itself.. You will, however, have to edit the form by hand rather than using the wizard.
The following should do the trick, and should be added in the Form JavaScript box:
Edit: Fixed bug; visibility property should be 'hidden', not 'hide'...
/Fredrik
As for Dynamic Forms, I believe the simplest approach would be a tiny JScript that toggles the visibility property of a container (<div> or such) or the object itself.. You will, however, have to edit the form by hand rather than using the wizard.
The following should do the trick, and should be added in the Form JavaScript box:
window.addEvent('domready', function() {
var quality = $('select_5');
quality.addEvent('change', function(event) {
var selected = quality.getValue();
switch (selected) {
case 'Adhérent Jumeaux et Plus':
$('text_6').style.visibility = 'visible';
$('text_7').style.visibility = 'visible';
break;
default:
$('text_6').style.visibility = 'hidden';
$('text_7').style.visibility = 'hidden';
}
});
});
Edit: Fixed bug; visibility property should be 'hidden', not 'hide'...
/Fredrik
Thanks GreyHead and Fredrik
I'll test that toonight and then publish my site.
Your help was greatfull
Hope to discuss with you for another think than problem...
Jerome
I'll test that toonight and then publish my site.
Your help was greatfull
Hope to discuss with you for another think than problem...
Jerome
bad news😢
The javascript code don't work. I put it in the 'Form Code'-->'Main OnLoad/View Code'-->'Form Javascript' box as you said!
the link is the same if you want to play with the form
Jérôme
The javascript code don't work. I put it in the 'Form Code'-->'Main OnLoad/View Code'-->'Form Javascript' box as you said!
the link is the same if you want to play with the form
Jérôme
Updated version, proper style properties, and applies the property to the parent div, rather than the input box - thus also hiding the label..
/Fredrik
window.addEvent('domready', function() {
var quality = $('select_5');
quality.addEvent('change', function(event) {
var selected = quality.getValue();
switch (selected) {
case 'Adhérent Jumeaux et Plus':
$('text_6').getParent().style.visibility = 'visible';
$('text_7').getParent().style.visibility = 'visible';
break;
default:
$('text_6').getParent().style.visibility = 'hidden';
$('text_7').getParent().style.visibility = 'hidden';
}
});
});
/Fredrik
That's better🙂
is-it possible to make textbox hidden at the start of the form?
The default choice is 'Selectionner' and not 'Adhérent Jumeaux et Plus' so, the textbox are visible until i select a quality
is-it possible to make textbox hidden at the start of the form?
The default choice is 'Selectionner' and not 'Adhérent Jumeaux et Plus' so, the textbox are visible until i select a quality
Sure,
You could try and add the visibility property directly into the form, but on the other hand, this code should work better with the wizard editor..
/Fredrik
You could try and add the visibility property directly into the form, but on the other hand, this code should work better with the wizard editor..
window.addEvent('domready', function() {
var quality = $('select_5');
quality.addEvent('change', function(event) {
var selected = quality.getValue();
switch (selected) {
case 'Adhérent Jumeaux et Plus':
$('text_6').getParent().style.visibility = 'visible';
$('text_7').getParent().style.visibility = 'visible';
break;
default:
$('text_6').getParent().style.visibility = 'hidden';
$('text_7').getParent().style.visibility = 'hidden';
}
});
$('text_6').getParent().style.visibility = 'hidden';
$('text_7').getParent().style.visibility = 'hidden';
});
/Fredrik
I'm installing the final site so i'll test this last code after.
Again, thanks a lot for your help
Jérôme
Again, thanks a lot for your help
Jérôme
This topic is locked and no more replies can be posted.