You are viewing limited content. For full access, please sign in.

Question

Question

{/_currentuser} variable not changing in the same form

asked on January 12, 2016

Hi,

I have the Form which has to route to different users,lets say User A creates the Form and fill some fields and i have added _currentuser variable field in the form,based on the {/_currentuser} variable i applied some field rules,like if {/_currentuser} is User A then show/hide fields and if {/_currentuser} is User B then show/hide some fields,here when user A submits the form ,when it reaches User B the variable still shows the User A value,so that field rules went wrong,but when i took the copy of the form then the {/_currentuser} variable gets changed,so i don't want to create multiple copies of the form,based on the field rules the process workflow should run in a single form.Hope understood my scenario..can anyone suggest me to achieve this?

1 0

Replies

replied on January 12, 2016 Show version history

No because you do not populate your field and the default value it is use only once. but

Here a sample script that should work for you

 

the script does : read the default value and assign it to the field at each time the form is load.

 

versus the default value is only take place when the field is empty normally.

#q9 = the ID of the field when you are on the java tad you can see the ID value of your field. so just replace the #q9 by the one on your form

$(document).ready(function () {    
  var newCurentUser = $('#q9 input')[0].getAttribute('default-val');
  $('#q9 input').val(newCurentUser);    
});

2 0
replied on January 12, 2016

I belive the fact this field is set first with the variable on the first load of the form. it will keep it and not really change it.

 

So you need a script to delete the content of that field when the forms load and assign it with the new {/_currentuser} that is open the present form.

 

0 0
replied on January 12, 2016

Hi Rene,

Without using script is there any alternative way to do this?I checked that other user had the same issue was solved by using lookup rule to populate the value in the field,but i am not sure whether it worked for them.

0 0
replied on January 13, 2016

Thanks for your quick response..

Actually that solved my issue,either by using scripts or look up rule we can assign the value to the current_user field.

0 0
replied on June 16, 2020

Although this is old post, but I think I should post a better solution for this so that anyone reaching this looking for an answer may find this useful; The best way to keep a (dynamic) token as default value and keep that field refreshed on each form is to add a field rule that hides the field and use "Ignore the data when the field/section/page is hidden" option. This way it will not save the default value when submitted and the next time it will get an updated token value (for example current user).

If you want to show the field, you'd add another field and have it copy the value using advance/calculation setting.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.