Page 1 of 1

Procedure: get value from FORM

Posted: Wed Aug 14, 2013 7:10 pm
by ruiascensao
Hi,

I'm building a "Procedure" and I'm using "$formValue" to get the value of the form field.
But it does not work. Any idea why?

Thank you for the support.

Re: Procedure: get value from FORM

Posted: Sun Aug 18, 2013 11:47 am
by massiws
Rui,
from wiki:
$formValue
This is an array of the Variables from the selection Form, created prior to running an activity
.

In selection form you should have, for example, an object with "my_obj" in All tab > Field Name.
In your procedure code you should have:

Code: Select all

$value = $formValue['my_obj'];
Hope this helps,
Max

Re: Procedure: get value from FORM

Posted: Sun Aug 18, 2013 8:59 pm
by zazzium
Hi,
$formValue works in report Data Code.
In Procedure u have to pass values with runIt function
e.g. runIt("pcode","val1","val2","val3")

and catch the values in Procedure PHP Code
$var1 = "#runIt1#";
$var2 = "#runIt2#";
$var3 = "#runIt3#";

http://wiki.nubuilder.com/tiki-index.ph ... nIt_pCode_

zazzium

Re: Procedure: get value from FORM

Posted: Mon Aug 19, 2013 2:49 am
by massiws
Rui, zazzium is right: sorry I misunderstood what you wrote. :oops:
zazzium, thanks for correcting me.

Re: Procedure: get value from FORM

Posted: Mon Aug 19, 2013 9:46 am
by ruiascensao
Hi,

Thanks!
I have this procedure with a filed:
procedure_asset.jpg
and I need to scan a asset tag (with a hand scanner with "return carriage").
After scan I need the the procedure to "run" (open the new window and close it when if finishes). The "Asset field" has then to be empty and ready to accept a new value.

Any advice?

Thank you.

Re: Procedure: get value from FORM

Posted: Mon Aug 19, 2013 11:10 am
by zazzium
Hi,

if u want a button, use "Extra Action Buttons" on the form.
add button title and "Javascript to run";

Code: Select all

runIt("procedureCode",$("#fieldName").val());
$("#fieldName").val(''); //clear the field for the next scan
where procedureCode is obviously procedure code and
$("#fieldName").val() fieldName is the fields name u need to pass to procedure.
pic:
http://prntscr.com/1m4f7y


in Procedure PHP Code:

Code: Select all

$var = '#runIt1#';

//do your stuff

echo "<html><body  onload='window.close()'></body></html>";
pic:
http://prntscr.com/1m4dk4


but u could activate the runIt() function automatically when the required field gets the value from the scanner with javascript.

hope it makes sense
zazzium

Re: Procedure: get value from FORM

Posted: Mon Aug 19, 2013 4:12 pm
by ruiascensao
Hi,

Perfect!! Thanks, its works.

Re: Procedure: get value from FORM

Posted: Mon Aug 19, 2013 9:40 pm
by massiws
.