One element depend on another element!

linomsai

Member
I have element Request Qty and Approval Qty. Approver should not be able to enter more than but can be less than the Request Qty number. I tried with the greaterorlessthan, but don't know what will be the condition? Pls guide with this option or any other way that can be implemented?
 
You don't need anything in "Condition" if you want to validate always, i.e. test < (or >).
If you want to allow "=" the condition must stop the validation in this case (e.g. return false if Request=Approval), so (if the validation is on the approval element) something like
return $data!='{your-table___request-element_raw}';
 
You don't need anything in "Condition" if you want to validate always, i.e. test < (or >).
If you want to allow "=" the condition must stop the validation in this case (e.g. return false if Request=Approval), so (if the validation is on the approval element) something like
return $data!='{your-table___request-element_raw}';

will it also validate in case if both the elements Request Qty and Approval Qty are in the repeat group. For eg. there is multiple request quantity for different materials in a form, and approver approves different quantity for different material. Will it check / validate in case if he approves more than requested qty. for a particular item?

A noticeable part is, while testing, following is the scenario:
1) If i applied the approval qty 10 out of the 12 requested quantity and saved, then
2) when i modify the same form and make the approval qty to 12 out of the request qty, it gives the error.

I would like to know, how does the greaterorlessthan works? for eg, if less than is selected, when will the validation rule will be applied. Basically just trying to understnd on what condition will it get invoked. How about a Flow chart in fabrik wiki. Probably that will help newbie fans can visualize the functions. ;)
 
I think you are confusing the validation itself with the condition. The 'condition' is not specific to the greaterorlessthan validation, it's on (almost) all validation rules, and just allows you to enter some custom PHP code to determine if you actually want to enforce the validation or not.

Anyway, after reading this thread, and doing some testing, I've updated this validations code to ...

1) Actually work with joined data. As far as I can tell, it would never have worked right with joined / repeated data.

2) I've added three more options, so you now have <, >, <=, >= and =. Which should solve your issue, and not require the workaround troester suggested with the Condition.

Changes should be in github.

-- hugh
 
Looks good! updated the latest from GitHub (Fabrik-fabrik-3.0.5-441-g7bf55cc.zip) got the option as mentioned. Works fine!
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top