Forums

Some fields cleared if Captcha not entered correctly

abasel 03 Feb, 2013
I need to work out why the fields "Program Code" and "Cost" are lost when the Captcha code is entered incorrectly.

http://www.cyberlab.co.nz/index.php/component/gcalendar/event/5/index.php?option=com_content&view=article&id=6&Bookings&programme=Gaming%20Developement:1023%20($250)&date=5%20Mar%202013%20-%207%20Mar%202013

I think it has something to do with the fact that these entries are pasted to the form and then created in the "On Load" event using the following custom code
<?php $mytitle=JRequest::getString('programme','post');
$titleChunks=explode(":", $mytitle);
$title=$titleChunks[0];
$titleChunks=explode("(",$titleChunks[1]);
$code=$titleChunks[0];
$titleChunks=explode(")",$titleChunks[1]);
$cost=$titleChunks[0];

$form->data['programme'] = $title;
$form->data['code'] = $code;
$form->data['cost'] = $cost;
?>


When the Captcha refreshes the screen they are lost. What I need is some way of locking them in
abasel 03 Feb, 2013
Worked it out, had to change the custom code to
<?php 
if ($form->data['code']=='') {
$mytitle=JRequest::getString('programme','post');
$titleChunks=explode(":", $mytitle);
$title=$titleChunks[0];
$titleChunks=explode("(",$titleChunks[1]);
$code=$titleChunks[0];
$titleChunks=explode(")",$titleChunks[1]);
$cost=$titleChunks[0];

$form->data['programme'] = $title;
$form->data['code'] = $code;
$form->data['cost'] = $cost;}
?>


The form was being reloaded and since the string was not being passed this time, the code and cost values where being lost. With the IF statement, if they have a value then they will not be reset.
This topic is locked and no more replies can be posted.