Validation based on user entry

fabrikg09

Member
I have a form element, where the default value is supplied from a value in a database table:

$user =& JFactory::getUser();
$userid = $user->get('id');
$database =& JFactory::getDBO();
$database->setQuery("SELECT points from #__alpha_userpoints WHERE `userid`= " . $userid);
$numPoints = $database->loadResult();
return $numPoints;

This is returned as a number, and Fabrik displays this in a box where the user can type in anything he wants. But the user's entry must not exceed the number supplied from the table.

I set the validation to <isgreaterorlessthan> and then <less than>

But I am not sure how to specify what to put in the condition box.

So I need to make the validation:

<less than or equal to $numpoints>
 
I would do it with a php validation:
fetch $numpoints again and compare against $data (the user's input)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top