How to retreive form element values for validations?

Status
Not open for further replies.

jfquestiaux

Well-Known Member
In a registration form, I have an element for email and one for the email confirmation.
I am trying to set a PHP validation on the confirmation field to check whether the second email entered matches the first one, but I don't seem to be able to retreive the correct data from the first email element.

In the confirmation email element, I set the following code in the "condition" box :
Code:
return $data == JFactory::getApplication()->input->get('email');
But no matter what I enter in this field, the validation is always OK.
Yet, the condition box works because if I write

Code:
return $data == '5';

the validation fires if I enter 5 and does not fire if I enter 4.

Note : this confirmation email element is in a (non repeated) joined group.

Joomla 3.0.2 - Fabrik 3.1 + yesterday's GitHub.
 
should 'email' not be 'listname___email' ?
so:

Code:
return $data == JFactory::getApplication()->input->get('listname___email');
 
Yes, it should. However, it is still not working and the resaon is probably this :

If I put a debug code inside the validation plugin, I get this for JFactory::getApplication()->input
JInput Object
Code:
(
    [options:protected] => Array
        (
        )

    ?.

    [data:protected] => Array
        (
            [option] => com_fabrik
            [view] => form
            [formid] => 36
            [Itemid] => 118
            [og6a1_users___id] => 
            [og6a1_users___name] => 
            [og6a1_users___username] => 
            [og6a1_users___password] => 
            [og6a1_users___password_check] => 
            [og6a1_users___email] => jfquestiaux@edpnet.be
            [og6a1_users___block] => 1
            ...
)

But if I replace it by JFactory::getApplication()->input->get('og6a1_users___email'), I get this:

jfquestiauxedpnet.be

This explain why the validation always fails. of course, I have no idea why the "@" is stripped out...
 
ah because get() now uses stricter input formatting, its the equivalent to the old JRequest::getCmd()

try

$input->get('foo', 'default', 'string');

the 'string' property tells Joomla to not filter the content
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top