Urgent - Latest GIThub update has blown away all records

Hugh, I have a question for you......

Using eval like this, for default values, what is the correct syntax.....would one also need quotes, I gather not?

return FabrikHelperElement::filterValue(290);

Paul
 
and further to this, is this correct for php plugins in forms?

$formModel->updateFormData('scores___username', {$my->username}, true);

Would we also need to put quotes around '{$my->username}' ?

Paul.
 
Using eval like this, for default values, what is the correct syntax.....would one also need quotes, I gather not?

return FabrikHelperElement::filterValue(290);
No you don't need any quotes there, there is no placeholder replacement occuring.

$formModel->updateFormData('scores___username', {$my->username}, true);
However, here you do.
This is how the process goes....
we get the text you have entered:

$formModel->updateFormData('scores___username', {$my->username}, true);
we parse it for place holders {......} and replace {.....} with the value, so your initial string becomes:

$formModel->updateFormData('scores___username', Rob, true);

as you can see here that produces incorrect php as Rob is not defined, and should have quotes around it, so if instead your initial text was:

$formModel->updateFormData('scores___username', '{$my->username}', true);

then after the replacement the code would be

$formModel->updateFormData('scores___username', 'Rob', true);

For things like replacing values that should be numbers I would still suggest encasing in quotes and then casting to an integer/float.:

$formModel->updateFormData('scores___username', (int)'{$my->id}', true);
so when parsed that becomes

$formModel->updateFormData('scores___username', (int)'62', true);
which is the same as
$formModel->updateFormData('scores___username', 62, true);

why do this? In case $my->id is empty, if it wasn't done like this then

$formModel->updateFormData('scores___username', {$my->id}, true);
would becomde

$formModel->updateFormData('scores___username', , true);
which is invalid PHP
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top