I have a form with a start date and end date. How can I use the fn: switch in the event to verify the end date is later than the start date after submit button is clicked.
I hope this trick can helps, in CCv6 enviroment:
i am not sure if I can call to one {view:function} from php code, so my only chance is I have to use switch function, the issue is that I need to do some php process with row values of a table_list and generate a new row value( not sure if I can save it in some way), for example
model.new_field={fn:field1_minus_field2}
-----------------------------------------------------------------in php function with name field1_minus_field2 I have:
field1=$this->get('table_list.row.model.field1');
field2=$this->get('table_list.row.model.field2');
echo field1-field2;
but after this operation I still need to use the "new_field" in order to view a button when is different than "0" (meaning: only when there are vacancies users can register)
so after some research I get sucess using a trick inside swith function
My new column is model.register:{fn:sw_button}
-------------------------------------------------------------------------I made a new php function compare_field1_and_field2
field1=$this->get('table_list.row.model.field1');
field2=$this->get('table_list.row.model.field2');
final= field1-field2;
return ($final ==0 ? 1: 0);
---------------------------------------------------------------------in my function sw_button
and now is the trick, in switch data provider i used this: {fn:compare_field1_and_field2}{var:compare_field1_and_field2}
and in values setup
1:FULL
0:{view:registro_button}
not sure if I can do it by other method, anyway I hope it helps because this works