This topic is locked
[SOLVED]

 pass values to button in add page

8/18/2017 8:06:55 AM
PHPRunner General questions
ffrinai author

Hi,

if I insert a button in add page, how may i pass the values of compiled fields (before press save) to the button in Client Before?
thanks
Fabio

ffrinai author 8/21/2017



Hi,

if I insert a button in add page, how may i pass the values of compiled fields (before press save) to the button in Client Before?
thanks
Fabio


found this solution:

Tab Client Before
ctrl.setMessage("Sending data to server.....");
$("#value_dtirif_1").select();

var ctrlF = Runner.getControl(pageid, "dtirif");

var valore = ctrlF.getValue();

$("#value_dtirif_1").blur();

params["dtiniz"]=valore;
alert(params["dtiniz"]);
the result of first alert is


Tab server:

$result["veas"] = $params["dtiniz"];
Tab Client After:

alert(result["veas"]);
the result of second alert is


why the second alert display a different date if the input is only one <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=82980&image=3&table=forumreplies' class='bbc_emoticon' alt=':(' /> ?

I can't work with the wrong date in Server tab !!!
This problem is only with date field, because a text field is correctly displayed in the two differents alert.
Thanks for help

Fabio

ffrinai author 8/21/2017



found this solution:

Tab Client Before
ctrl.setMessage("Sending data to server.....");
$("#value_dtirif_1").select();

var ctrlF = Runner.getControl(pageid, "dtirif");

var valore = ctrlF.getValue();

$("#value_dtirif_1").blur();

params["dtiniz"]=valore;
alert(params["dtiniz"]);
the result of first alert is


Tab server:

$result["veas"] = $params["dtiniz"];
Tab Client After:

alert(result["veas"]);
the result of second alert is

why the second alert display a different date if the input is only one <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=82981&image=3&table=forumreplies' class='bbc_emoticon' alt=':(' /> ?

I can't work with the wrong date in Server tab !!!
This problem is only with date field, because a text field is correctly displayed in the two differents alert.
Thanks for help

Fabio


Find the solution !!!!!!!!!!

the problem is differece from javascript date to php date, must add the conversion

var locale_date_string = valore.toLocaleDateString(); to client before, then:
Tab Client Before:
ctrl.setMessage("Sending data to server.....");
$("#value_dtirif_1").select();

var ctrlF = Runner.getControl(pageid, "dtirif");

var valore = ctrlF.getValue();

$("#value_dtirif_1").blur();

var locale_date_string = valore.toLocaleDateString();

params["dtiniz"]=locale_date_string;
alert(params["dtiniz"]);
Tab Server:

$result["veas"] = $params["dtiniz"];
Tab Client After:

alert(result["veas"]);
now in server tab I can right work with values from add page !!!

P.s. sorry for my non perfect english <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=82981&image=4&table=forumreplies' class='bbc_emoticon' alt=':blink:' />