I have a form that accepts presenter applications for a conference. It working in Joomla 1.5 for a couple of years and I haven't really looked at it in awhile. I upgraded the site to 2.5.18 and upgraded Fabrik initially to 3.0, then ended up with 3.1, since the github file said it could be used with J! 2.5. I really didn't think this form would be used again, but now I need to get it working. Several things were not working after the upgrades, but most are now sorted out. I have a php plugin that runs when the form is submitted, (onBeforeprocess) that I cannot get to work correctly. My list is for applicants. An applicant may or may not apply with up to 5 copresenters, so copresenters are in a repeating group. There is a field called copresenter that is a dropdown with values of 0 - 5. If an applicant selects between 1-5, the 1st repeating group fields should be shown for them to enter the copresenter information. If they say they will have 3 copresenters, they are required to enter information for 3 copresenters. The plugin is checking to make sure that the number of copresenters entered matched the number selected in the dropdown box. I may not be setting the error message correctly. I followed the instructions in the wiki, but am not seeing what is wrong.
No matter what is entered in the form, a syntax: JSON parse error is displaying on submit and the form then tries to start validating the first field again and the validation spinner just keeps spinning.
I am uploading a screen shot of the error and a portion of what I am displaying in Firebug. The php code is below.
The other issue I am having is that when the copresenter dropdown changes, if it >0 the first empty occurance of the repeating group copresenter should be shown. It was working in Firefox at one point, with Fabrik 3.0, but since moving to 3.1 it will only show the "empty data" box with the +/-. Once you click on the + the fields display, but I would like the first occurance to show as soon as the # of copresenters changes. Since the upgrade it has not worked that way in Chrome. That is how it worked in the past, under J!1.5.
Thank you! I appreciate the help.
the php plugin - from /plugins/fabrik/php/scripts...
<?php
/**
* this is a very simple example of a script to stop the form being processed
* The form is then redisplayed with an error
* notice at the top of the form (and the previously filled in data still visible)
*/
$formModel->formData;
echo "<pre>";print_r($formModel->formData);
$repeatTotals = $formModel->formData['fabrik_repeat_group'][16];
$copres = $formModel->formData['fab_applicant___copresenters'];
echo "repeat group";
echo var_dump($repeatTotals);
echo "copres";
echo var_dump($copres);
if ($copres != $repeatTotals)
{$formModel->errors['fab_applicant___copresenters'][] = 'Please enter contact information for all copresenters';
return false;
}else
{return true;}
?>
No matter what is entered in the form, a syntax: JSON parse error is displaying on submit and the form then tries to start validating the first field again and the validation spinner just keeps spinning.
I am uploading a screen shot of the error and a portion of what I am displaying in Firebug. The php code is below.
The other issue I am having is that when the copresenter dropdown changes, if it >0 the first empty occurance of the repeating group copresenter should be shown. It was working in Firefox at one point, with Fabrik 3.0, but since moving to 3.1 it will only show the "empty data" box with the +/-. Once you click on the + the fields display, but I would like the first occurance to show as soon as the # of copresenters changes. Since the upgrade it has not worked that way in Chrome. That is how it worked in the past, under J!1.5.
Thank you! I appreciate the help.
the php plugin - from /plugins/fabrik/php/scripts...
<?php
/**
* this is a very simple example of a script to stop the form being processed
* The form is then redisplayed with an error
* notice at the top of the form (and the previously filled in data still visible)
*/
$formModel->formData;
echo "<pre>";print_r($formModel->formData);
$repeatTotals = $formModel->formData['fabrik_repeat_group'][16];
$copres = $formModel->formData['fab_applicant___copresenters'];
echo "repeat group";
echo var_dump($repeatTotals);
echo "copres";
echo var_dump($copres);
if ($copres != $repeatTotals)
{$formModel->errors['fab_applicant___copresenters'][] = 'Please enter contact information for all copresenters';
return false;
}else
{return true;}
?>