Forums

run javascript when the form is submitted

pelucre 29 Sep, 2011
Hello,

I wish that a click on the "submit" button starts only a personnal javascript function and sending emails.
In the final I don't wish the form is reloaded.

how may I parametrize chronoform to do it?

Thanks in advance for your help.
pelucre 30 Sep, 2011
Nobody can help me😟
GreyHead 30 Sep, 2011
Hi pelucre,

You can add a JavaScript to run on the onSubmit event (though it may be better to use the onClick event for the submit button to avoid problems with the form validation).

You can use the ReDirect URL to show some other page after the form is submitted and emails are sent.

Bob
pelucre 30 Sep, 2011
Thanks for your answer,

When I use the redirect URL, the following error appears

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in bbcconcept/www/administrator/components/com_chronoforms/form_actions/redirect_url/redirect_url.php on line 28

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in bbcconcept/www/administrator/components/com_chronoforms/form_actions/redirect_url/redirect_url.php on line 28

Warning: array_merge() [function.array-merge]: Argument #2 is not an array inbbcconcept/www/administrator/components/com_chronoforms/form_actions/redirect_url/redirect_url.php on line 28

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in bbcconcept/www/administrator/components/com_chronoforms/form_actions/redirect_url/redirect_url.php on line 28


form URL : http://www.bbcconcept.net/index.php/contact/2-bbc-concept/11-devis

How can chronoforms reloaded items entered by the user before submitting in redirect URL?
GreyHead 01 Oct, 2011
Hi pelucre,

I think that the problem is because you are using an SEF URL In the Target URL box :-(

If you use a 'real' url like
http://www.bbcconcept.net/index.php?option=com_contact&bbc-concept=2&devis=11
or whatever the right valuse is - then it should be OK.

Bob
pelucre 03 Oct, 2011
I changed the redirect URL by the real value

http://www.bbcconcept.net/index.php?option=com_content&view=article&layout=edit&id=11


But the errors continue😟
GreyHead 03 Oct, 2011
Hi pelucre,

There are no errors - just PHP Warning messages. I'm not sure why you are seeing them though.

Does the code behave correctly apart from the messages? If so, then set Error Reporting to 'System Default' or 'None' in your site Global Configuration.

Bob
pelucre 03 Oct, 2011
I don't know if the code behaves correctly apart the messages because nothing else appears on the page after submitting.

For information, Error Reporting is set to "None" in my site Global Configuration and apparently the page isn't redirected to an other URL (just &event=submit is added at the end of the form URL)
GreyHead 03 Oct, 2011
Hi pelucre,

A blank page and &event=submit in the URL is the normal behaviour if your form does not have a Thank YOu message set and is not ReDirecting.

It sounds as though the ReDirect User action isn't being called. Where is it in the OnSubmit event?

Bob

PS I just tried to submit the form from your redirect link but it looks as though you have required inputs that are set to readonly so it wasn't possible.
pelucre 03 Oct, 2011
Thank you for your explanation of the blank page, I added the redirection of users and now the warnings are gone.🙂

I fixed my javascript function that sets different fields readonly.

But now how do I set ChronoForms to send the field values ​​entered by the user when redirecting the URL?

For example, the user's name, address and pack choices (radio button).
pelucre 03 Oct, 2011
I found how send the field values but i have a problem with email, checkbox and radiobox.

I think I need to use the "handle arrays" but i dont't know how and i don't find a tutorial.

Can you explain me ?

Thanks for your help
GreyHead 03 Oct, 2011
Hi pelucre,

If you search here on Handle Arrays you will find dozens of posts with the answer!

In CFv3 set 'Let ChronoForms handle arrays' to 'Yes'.

In CFv4 drag a Handle Arrays action to the On Submit event and move it before the Email or DS Save actions.

Bob
This topic is locked and no more replies can be posted.