AKOM

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Clearing the values of fiellds on form save #28841
    AKOM
    Participant

      Thank you. But I have some 70 fields that are conditionally shown and hidden.
      So I was trying to find some option to identify all those hidden elements at once, instead of building an array, on PreSaveAction
      The below code does the trick to reset the select dropdowns . But I was wondering if there is a better way or inbuilt option?

      
      
       function PreSaveAction()
      {    $("td[<strong>style$='display: none;</strong>']").closest('td').find("input").each(function(j) {
                $(this).attr('value','');
       });
       $("td[style$='display: none;']").closest('td').find("select").each(function(i) {
          $(this).prop('selectedIndex','-1');
         });
      }

      Is there an easy way to set fields to Not required when the fields are hidden in a dffs form? I am using flag_Mandatory and clear_Mandatory to conditionally make fields required and vice versa but it’s becoming very messy when I have multiple functions being called amking some fields to show and others to hide.

      in reply to: Easy way to make all fields readonly? #28810
      AKOM
      Participant

        Is there are easy way to set all invisible fields (fields that I have set to hide using “.hide” in my JS ) in a tab to clear out or empty them when form is saved?

        i have tried this
        $(“td[style$=’display: none;’]”).closest(‘tr’).find(“select”).each(function(i) {
        alert($(this).prop(‘title’));
        $(this).prop(‘selectedIndex’,’-1′);

        });
        But it is picking all the selects boxes not just one where display: none.

      Viewing 2 posts - 1 through 2 (of 2 total)