0

I have a dropdownlist and when I selected a value from it I am checking the value from another table and according to returning value I change the visibility of a layout item. Now I need to set it Required if it is visible(If the value from ajax is 3 or 5). How can I do it? Here is my ajax that set visible or not.

Edit: I want to set liGid required when in if condition.

`$.ajax({
   type: "POST",
   url: "TestPage.aspx/GetCode",
   data: '{"XKod":"' + s.GetValue().toString() + '"}',
   contentType: "application/json; charset=utf-8",
   dataType: "json",
   success: function (msg) {
      if (msg.d.GrupKodu == 3 || msg.d.GrupKodu == 5) {
         fytbTab0.GetItemByName('liGid').SetVisible(true);
      }
      else {
         fytbTab0.GetItemByName('liGid').SetVisible(false);

      }
   }
});`
F K
  • 13
  • 1
  • 5
  • [setting the required field](https://stackoverflow.com/questions/18770369/how-to-set-html5-required-attribute-in-javascript) – Stasis May 17 '18 at 06:49

1 Answers1

0

Add the line

 fytbTab0.GetItemByName('liGid').required = true;
Ash-b
  • 705
  • 7
  • 11