Validation with condition on multipage

procajlok

Member
Hello! :)
In Fabrik 3.8 i have multipage form. On first page i have calc field with number (calc on save):
PHP:
$var = (int) '{zgloszenia___gr_iloscOs}';
if (!empty ($var))
{
return "1";
}
On the same and next page (where i have repeat group) i have fields with validation where condition is
PHP:
return '{zgloszenia___gr_etap1}' == 1;
and On:Edit; Must validate:Yes; Show valid icon:Yes.

This i made for take mandatory fields on second (or third etc.... - depending on the calc field configuration) edit record by user.

At the moment I see one problem:
After save, when calc field == 1 validation run only when i try submit record (on last page) and form don't go to first page where i have this fields. I want to run validation on go to next page! :)
 
On first page i have calc field with number (calc on save)
"calc on save": do you mean you've set "only calc on save" = YES (default is NO)?
If set to YES it will only calc on save.
What are your exect settings?
 
And is zgloszenia___gr_etap1 the calc element?
Yes this is calc element. Calculation return is stored in the database and indicates whether the user has completed the fields within the first stage of filling the record. First stage is when user create record and fill two mandatory fields. Second stage is when user edit his record and '{zgloszenia___gr_etap1}' == 1 (like in notempty conditions) - then other fields are mandatory.

I hope I write it clearly :)

"calc on save": do you mean you've set "only calc on save" = YES (default is NO)?
If set to YES it will only calc on save.
What are your exect settings?
Yes, exactly.

In fact - my problem is not PHP calc, store correct value and validation conditions. It will work, i think ;)
My problem is that I would like the validation run before moving to the next page in multipage form :)
 
I'm still unclear on what the problem is. Do you mean you want the validation run, or the calc to run in AJAX mode?

Validations should always run on the page you are navigating away from.

-- hugh
 
Is is not validating or is the condition not true?

What happens if you clear the condition?

What do you get if you do
var_dump('{zgloszenia___gr_etap1}');exit;
in the condition?
 
What happens if you clear the condition?
When condition is clear, validation run before we go to next page and the message is displayed correctly (red label, popup at the top of field).

What do you get if you do
var_dump('{zgloszenia___gr_etap1}');exit;
in the condition?
Nothing happens. I cant go to the next page. The form temporarily dims and stays on the same page without displaying any error.
There is also no information about what is happening "in the background".

If you were so kind, of course, you can log in and check what is happening on the system - DEV SDM. :)
 
I see
SyntaxError: Unexpected token s in JSON (what was to expect with the var_dump)
and
string(0) ""
in the network response.

So your gr_etap1 is empty.
You have set "only calc on save"=yes, so - it's only calculating on save (and not on page navigation).

Remove the var_dump
set "only calc on save"=no
and maybe ajax calculation = yes
 
Last edited:
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top