1
0
-1

Having a scenario that, I am keeping five fields in five different page and have to map the value of those fields to the data driven radio button dynamically using data field. After adding those five options to radio button how will I remove a particular option from the radio button and how to clear the value of field that has been mapped to radio button from a page. For example, I have to delete the third option of radio button and have to remove the field value in third page.

Kindly assists on this.

Thanks.

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      Hi,

      splice works on arrays, so make sure the object you apply it to is an array.

      In my test form, I have this in a Form Load rule:

         data.$myDataField = [{label:'a', value:'A'}, {label:'b', value:'B'}, {label:'c', value:'C'}]

      and I have this in a Click rule on a Button to remove the second element from the array:

          data.$myDataField.splice(1,1)

      To add a new element to the end of the array, you would do something like this:

          data.$myDataField.push({label:'d', value:'D'})

      You can also use splice to insert new elements into an array.  See https://www.w3schools.com/jsref/jsref_splice.asp

      1. Vinodhini AshokKumar Kavitha

        Thanks Bill.
        How can i find the selected option from data driven radio button, so that instead of using splice method i can remove the options that is being selected.

      CommentAdd your comment...
    2.  
      1
      0
      -1

      Hi,

      To remove the third option from your radio button group, use code like:

          data.radioGroupDataFieldArray.splice(2,1)

      To remove the value from your related other field, just set its data value to empty with code like:

          data.thirdPageDataFIeld = ''


      1. Vinodhini AshokKumar Kavitha

        Thanks Bill.


        And also i need to add the options to the data driven radio button dynamically from the fields in the next pages using data field.

        Kindly assists on this too.


        Thanks.

      2. Vinodhini AshokKumar Kavitha

        Splice() method is not accepting in Maestro. I am getting an undefined error on console. Help to resolve this issue. Thanks.

      CommentAdd your comment...