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

Question

Question

Field Rule Not Working Initially

asked on July 28, 2021

I've set up a field rule to show Rejection Comments when action is reject:

However, when the form loads, it still shows the Rejection Comments even though both of my radio buttons are not selected.

When I select Approve, RJ disappears. When I selection Reject, RJ stays there (or reappears if I chose Approve first).

Why?

0 0

Answer

SELECTED ANSWER
replied on July 30, 2021

So I saw in another post that sometimes the required hidden field (in this case, the Rejection Comments) causes the Approve button to not work. I removed the required attribute from Rejection Comments and it to worked! Now I'm setting that field as required when it shows. I'm all set now!

Thanks for all the help!

1 0

Replies

replied on July 28, 2021 Show version history

You most likely have another rule lower down that's causing it to show on form load (field rules are run top down). The later rule is causing it to show initially, but triggering rule 1 would then get it working after the fact. The other rule is probably something like

Hide Rejection Comments if (condition that isn't met)

See if you have other rules targeting this field. 

0 0
replied on July 28, 2021

I only have one rule. This is it. I've never had this happen before. I have the same rule set on other forms, and those are working just fine.

0 0
replied on July 28, 2021

What version are you on? This looks like a bug because what you have looks correct. I'm wondering if it's because the condition about Reject is the first thing on the form so it loads up in focus. A couple things to test would be swapping the order of Approve and Reject here, or try putting a field above Action: just to see if either would get this work. 

0 0
replied on July 29, 2021 Show version history

UPDATED:  We are on Laserfiche Forms Professional Version 10.4.1.164. I put a field above Action, and it solved my issue BUT only the first time through. When I rejected and received that task back, it didn't solve my issue:

I think it has to do with "on form open", it runs the Field Rules first, and the JavaScript second. In the JS, I clear the Reject value, but because Field Rules runs first, it doesn't know that yet and still sees a Reject. So, I decided to put the show/hide in JS:

$(document).ready(function(){

//Reset "Action" radio buttons and rejectionComments field
  $("#Field67-0").prop("checked", false); //clear reject button
  $("#Field67-1").prop("checked", false); //clear approve button
  $('.rejectionComments textarea').val('');
  $('.rejectionComments').hide();

//Show/Hide Rejection Comments field
  $('.action input').change(function () {
    if ($(this).val() == "Reject")
    {
      $('.rejectionComments').show();
    }
    else
    {
      $('.rejectionComments').hide();
    }
  });
  $(".action input:checked").each(function(){  
    $(this).trigger('change');
  });

});  //close document.ready

Works great, but now I have a new issue. Rejections work great! But when I try to Approve, my "Task Complete" button does nothing.

 

I'm close! In case you wanted to see my Outflows:

0 0
replied on July 30, 2021

Triggering a change event when you clear the value should trigger the field rule.

I always do .val('').change() to ensure field rules, calculations, etc., are properly updated.

1 0
SELECTED ANSWER
replied on July 30, 2021

So I saw in another post that sometimes the required hidden field (in this case, the Rejection Comments) causes the Approve button to not work. I removed the required attribute from Rejection Comments and it to worked! Now I'm setting that field as required when it shows. I'm all set now!

Thanks for all the help!

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

Sign in to reply to this post.