Automate

 View Only
  • 1.  Fill in all rows mandatory in repeating table

    Posted 04-28-2023 09:49

    Hello
    I have a repeating table with a longtext. This longtext could be filled or not. BUT when the user what to fill the longtext he has to fill mandatory all 4 rows (alle 4 language). So which rule could verifie "if the user has insert a value in one of the 4 rows, then all rows must be have a value" ?
    Please see picture: this should not be allowed.

    Thanks for your help.



    ------------------------------
    Jana Kuschmierz
    Rigips AG
    ------------------------------


  • 2.  RE: Fill in all rows mandatory in repeating table

    Employee
    Posted 04-28-2023 12:28

    Hi Jana,
    Please try below mentioned javascript code, apply it as a custom javascript code on the field you want to set required/not-required.
    ------------------------

    var rows = count('/my:myFields/my:Repeating_Table_2/my:Repeating_Content/my:field_2');
    var isRequired = false;
    for(var i =0;i<rows;i++)
    {
        if ($form.getValue('/my:myFields/my:Repeating_Table_2/my:Repeating_Content['+i+']/my:field_2') !== '') { 
    isRequired= true;
    break;
         }
    }
     
    if(isRequired)
    {
       for(var i =0;i<rows;i++)
         {
    $form.setControlRequired('/my:myFields/my:Repeating_Table_2/my:Repeating_Content['+i+']/my:field_2', true);
         } 
    }
    else
           for(var i =0;i<rows;i++)
         {
        $form.setControlRequired('/my:myFields/my:Repeating_Table_2/my:Repeating_Content['+i+']/my:field_2', false);
        $form.removeErrorInfo('/my:myFields/my:Repeating_Table_2/my:Repeating_Content['+i+']/my:field_2')
         }
    }
    ------------------------------------------
    Note : (/my:myFields/my:Repeating_Table_2/my:Repeating_Content/my:field_2) -- this xpath of the field/textArea that you want to set required/not-required.

    -----------------
    Hope this helps.

    Regards


    ------------------------------
    Hammad Naeem
    Precisely Software Inc.
    ------------------------------



  • 3.  RE: Fill in all rows mandatory in repeating table

    Posted 05-01-2023 07:52

    Hello

    thank you so much, that works really fine.

    Jana



    ------------------------------
    Jana Kuschmierz
    Rigips AG
    ------------------------------