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

Question

Question

Field Rules Not Working on Value Changed by JavaScript Bug?

asked on December 28, 2018

I have a form that has the following JavaScript:

//Populates field with current step id
  //Check whether the input exist before get the attribute will avoid get error on submitted form as the elements are different
  if($('#q222 input')[0]!=null){
    var newStepID = $('#q222 input')[0].getAttribute('default-val');
    $('#q222 input').val(newStepID); 
  };

The concept is that it will fill a field (#q222) with the current step id as it moves from user task to user task. That part works great.

However, when I create Field Rules based on the value of that field they do not work correctly. As an example, I have a User Task that has an ID of 50 and another that has an ID of 52. The User Task with an ID of 50 is assigned first after the form is submitted. The User Task with an ID of 52 is assigned after 50 is completed. I have a Field Rule setup as follows:

For some reason, even though on the form itself it is showing the Current Step ID field (#q222) as having a value of 52 when it gets to the second User Task, the field rules are not reading it correctly. If I switch the 52 in the Field Rule to 50 it shows the field in question.

Does anyone know why this is happening? A bug maybe? Using Forms 10.3.1.635.

2 0

Answer

SELECTED ANSWER
replied on December 28, 2018 Show version history

maybe try adding .change() to the code? the Field rules might trigger based on the change.

$('#q222 input').val(newStepID).change(); 

 

1 0
replied on December 28, 2018

That was it. Thank you Chris!

2 0

Replies

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

Sign in to reply to this post.