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

Question

Question

Table Add button

asked on May 16, 2016 Show version history

Hi,

I have four fields that take part in a lookup that fills a table. There's a fifth one that is a dropdown that has three options, "Add", "Delete" and "Change" and a sixth one which is also a drop down of values "New" and "Old".  When you fill the six fields and press the lookup, data is filled into the table and you can either change it or delete a row or add more rows.  There are two challenges am facing

1) To disable the add row button when the drop down choice is not Add

2) There is a certain combination of two when you choose a combination of the fifth and sixth fields, e.g. "Old" and "Add", I want to disable the Autofill button or hide it. Thanks

Mark 

0 0

Replies

replied on May 16, 2016

The two chanllenges you mentioned can be solved by using custom JavaScript. You may try the following code (remember to update the id with your own ids):

$('document').ready(function() {
  $('#Field1').change(function() { //Field1 is the fifth field
    UpdateAddBtn();
    UpdateAutoFillBtn();
  });
   $('#Field2').change(function() { //Field2 is the sixth field
    UpdateAutoFillBtn();
  });
  function UpdateAddBtn()
  {
      if ($('#Field1').val() == 'Add')
      {
        $('#q5').hide(); //q5 is the id for the 'Add' button of the table
      }
      else
      {
        $('#q5').show();
      }
  }

  function UpdateAutoFillBtn()
  {
      if ($('#Field1').val() == 'Add' && $('#Field2').val() == 'Old')
      {
        $('#lookup70').hide(); //lookup70 is the id for the autofill button
      }
      else
      {
        $('#lookup70').show();
      }
  }
})

 

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

Sign in to reply to this post.