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

Question

Question

Assigning field attributes using a radio button in a table row.

asked on April 12, 2017

We have a form with a table and 3 fields in it. One of the fields is a radio button. We are trying to get it setup where if they select a value from the radio button the form will require the text field  to be filled in next to it.

We have tried a few things and haven't had much results. This code is the closest thing I've come up with but it is still not working. Does any one have any ideas?

$(document).ready(function () {
  updatefield();
  
  $('.inspectiontable').change(updatefield);
  
  function updatefield() {
    $('.inspectiontable tbody tr').each(function () {
      var insType = $(this).find('.raiting input:checked').val();
      switch (insType) {
        case "Unsatisfactory":
          $(this).find('.explain input').attr('required', true);
          return;
        default:
          $(this).find('.explain input').removeAttr('required');
          return;
      }
    });
  }
});
  

 

0 0

Answer

SELECTED ANSWER
replied on April 12, 2017

In version 10.x you can, Field Rule example below, the only challenge is that as the Field is in a Table, this hides the Field and not the Field Label. 

0 0

Replies

replied on April 12, 2017

Hi Shane

Another strategy is to make the Explain Field a required Field, and then use a Field Rule to only show the Field when the Unsatisfactory Option is checked. You can avoid the Javascripting with this method.

A Required Field is only becomes Active when it is shown.

0 0
replied on April 12, 2017

Hey Steve,

I don't believe that is an option as the fields are part of a table in forms and tables do not evaluate field rules .

0 0
SELECTED ANSWER
replied on April 12, 2017

In version 10.x you can, Field Rule example below, the only challenge is that as the Field is in a Table, this hides the Field and not the Field Label. 

0 0
replied on April 13, 2017

should have read the release notes closer. Obviously we will implement this when we update. Thanks for the heads up!

0 0
replied on January 6, 2023

Validate field as required or optional using field rules is supported in new form designer with Forms 11 Update 3.

You can see other changes of Forms 11 Update 3 from  https://support.laserfiche.com/kb/1014413/list-of-changes-for-laserfiche-forms-11-update-3 and get Forms 11 Update 3 from Laserfiche 11 package  https://support.laserfiche.com/kb/1014263/software-versions-and-fixes-included-in-the-laserfiche-11-download-package.

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

Sign in to reply to this post.