Hi,
I have a form that uses curl to register the user into an external site. If the registration fails, because for example, the api for the external site tells me that the username or email is already registered, I currently just echo the error message via the external code section of the CURL plugin. However, what i would like to do is in addition to the specific message, display the form again, with all previously entered values, so the user doesn't have to re-enter everything just because they had one or two errors. Is this possible? If so, what's the best way to go about doing this?
I have a form that uses curl to register the user into an external site. If the registration fails, because for example, the api for the external site tells me that the username or email is already registered, I currently just echo the error message via the external code section of the CURL plugin. However, what i would like to do is in addition to the specific message, display the form again, with all previously entered values, so the user doesn't have to re-enter everything just because they had one or two errors. Is this possible? If so, what's the best way to go about doing this?
Hi njaksic,
I thnk that this will reshow the form.
Bob
I thnk that this will reshow the form.
<?php
$MyForm->showForm('form_name', $posted);
?>
where $posted is the current form data array and is probably alredy defined by ChronoForms.Bob
Thanks, I didn't know you could do that -- unfortunately it doesn't work in this case and I think it's because I'm doing this in the extra code section of the CURL plugin. I got the following error:
Fatal error: Call to a member function showForm() on a non-object in /home/clubusa/public_html/components/com_chronocontact/plugins/cf_CURL.php(292) : eval()'d code on line 16
Is there a way to access this class from the curl plugin? Alternatively, I could try to put the showForm code somewhere else but then how will I obtain the specific error messages that CURL returned?
Fatal error: Call to a member function showForm() on a non-object in /home/clubusa/public_html/components/com_chronocontact/plugins/cf_CURL.php(292) : eval()'d code on line 16
Is there a way to access this class from the curl plugin? Alternatively, I could try to put the showForm code somewhere else but then how will I obtain the specific error messages that CURL returned?
Hi njaksic,
Please try the attached version of the plugin. Unzip and copy:
a) the 'plugin.php and 'plugin_2.php' files to administrator/components/com_chronocontact/helpers
b) the cf_CURL.php file to components/com_chronocontact/plugins
I've changed the helper so that the Plugin has $MyForm available; and I've split the helper in two as much of it is only needed for the back-end configuration tabs.
Please keep the old files just in case !!
Bob
Please try the attached version of the plugin. Unzip and copy:
a) the 'plugin.php and 'plugin_2.php' files to administrator/components/com_chronocontact/helpers
b) the cf_CURL.php file to components/com_chronocontact/plugins
I've changed the helper so that the Plugin has $MyForm available; and I've split the helper in two as much of it is only needed for the back-end configuration tabs.
Please keep the old files just in case !!
Bob
Thanks Bob, that works! What I have now is a bunch of debug messages, which I will try to get rid of, then my echoed error message, and then the form. The values that I had entered earlier do not get filled in automatically so in my form code I echoed the values from $_POST, which seems to work. Thanks again for your help and for this plugin!
Hi njaksic,
Sorry - hopefully it's just that the 'Debug' setting in the plugin configuration is set to 'Yes'.
There are a couple of other features that might be useful.
[list=][*]The 'Extra Fields data' box will take either param_name=value or param_name={field_name}[*]The CURLOPT settings box will take CURLOPT_XXX=value so that you can add or over-ride the default CURLOPT settings if you need to.[/list]
Bob
Sorry - hopefully it's just that the 'Debug' setting in the plugin configuration is set to 'Yes'.
There are a couple of other features that might be useful.
[list=][*]The 'Extra Fields data' box will take either param_name=value or param_name={field_name}[*]The CURLOPT settings box will take CURLOPT_XXX=value so that you can add or over-ride the default CURLOPT settings if you need to.[/list]
Bob
Hi Bob,
Thanks, I actually figured out the extra fields box the other day, after wrongly putting single quotes around the (string) values, which the external api didn't like. Once I put just plain values, it all worked perfectly.
As for the debug messages, commenting out the echo messages in plugin_2.php is what did it (I think it was only inside the paramsToArray function).
Cheers,
-nj
Thanks, I actually figured out the extra fields box the other day, after wrongly putting single quotes around the (string) values, which the external api didn't like. Once I put just plain values, it all worked perfectly.
As for the debug messages, commenting out the echo messages in plugin_2.php is what did it (I think it was only inside the paramsToArray function).
Cheers,
-nj
This topic is locked and no more replies can be posted.