How to set the initial value of Input Form in UI Designer

1
0
-1

Hi,

Just want to ask how to show in the input field a specific value. I want to show it once the task is been returned to the user for them to see the initial value and then they will decide whether to retain the value or not. I used java scripting method but it is not working. I don't know if my javascript below is correct since I dont know the name or id of the input box in bonita. I only use the value I assign as the name of the field and then set the value.

Here is my javascript below:

var bName = $data.request.name;
var bDFname = $data.preparedByUser.firstname + ' ' + $data.preparedByUser.lastname;

if(bName.equals(null) || bName.equals(""))
{
$('$data.formInput.bearerName').val(bDFname);
}
else
{
$('$data.formInput.bearerName').val(bName);
}

Please help thanks.

1 answer

1
+1
-1
This one is the BEST answer!

Hello
Could you explain the process in a bit more detail ?
Here is how I would do it.
Create a Variable in the UI designer / Form called formInput of type JSON.
Declare formInput as below

{ "name" : "Firstname.lastname" }

Now in your form Input field , in the value field, make it formInput.name
Now Take another variable called formOutput of Type Javascript.
Declare formOutput as below

return $data.formInput;

if you change the value in your input field, output also changes.
Else output remains the same.

Notifications