Skip navigation
noos76
Currently Being Moderated

dynamically change the caption to the radio button

Apr 17, 2012 3:44 AM

hello you can change the caption for the radio button dynamically? within a loop?

 

I tried these 5 education but do not work:


    list.RadioButtonList.nomelist.resolveNode("caption.value.#text").valu e = xfa.record.modulo.list.nodes.item(i).nomelist.code.value;

    list.RadioButtonList.nomelist.selectedMember().caption.value.text.val ue = xfa.record.modulo.list.nodes.item(i).nomelist.code.value;

    ListOggetto.resolveNode("caption.value.#text").value = xfa.record.modulo.list.nodes.item(i).nomelist.code.value;

    ListOggetto.selectedMember().caption.value.text.value = xfa.record.modulo.list.nodes.item(i).nomelist.code.value;

    list.RadioButtonList.nomelist.caption.value.resolveNode("#text").valu e = xfa.record.modulo.list.nodes.item(i).nomelist.code.value;

 

this code:

//file xml

var numero = xfa.record.modulo.list.nodes.length;

 

for(i=0; i<numero; i++){

 

    var ListOggetto = xfa.resolveNode("list.RadioButtonList.nomelist["+i+"]");

   

    list.RadioButtonList.nomelist.resolveNode("caption.value.#text").valu e = xfa.record.modulo.list.nodes.item(i).nomelist.code.value;

    list.RadioButtonList.nomelist.selectedMember().caption.value.text.val ue = xfa.record.modulo.list.nodes.item(i).nomelist.code.value;

    ListOggetto.resolveNode("caption.value.#text").value = xfa.record.modulo.list.nodes.item(i).nomelist.code.value;

    ListOggetto.selectedMember().caption.value.text.value = xfa.record.modulo.list.nodes.item(i).nomelist.code.value;

    list.RadioButtonList.nomelist.caption.value.resolveNode("#text").valu e = xfa.record.modulo.list.nodes.item(i).nomelist.code.value;

 

}

 
Replies
  • Currently Being Moderated
    Apr 17, 2012 7:54 AM   in reply to noos76

    Try this:

     

    form1.p1.Button1::click - (JavaScript, client)

     

    var number = xfa.resolveNode("xfa.form.form1.p1.rbl").nodes.length; //figure out how many children the exclusion group has

     

    for (i=0;i<number;i++) {
    xfa.resolveNode("xfa.form.form1.p1.rbl.rb[" + i + "].caption.value.text").value = "new caption for RB " + (i+1); //assumes all children are named 'rb'
    }

     

     

    result should be :

     

    New caption for RB 1

    New Caption for RB 2

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 17, 2012 8:25 AM   in reply to noos76

    Please look at my sample:

     

    https://acrobat.com/#d=8WKhVvc-uMnJdnNZj007oQ


    It looks like the context is wrong in your script.

     

     

    KJ

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 17, 2012 9:01 AM   in reply to noos76

    Your proble was in the script:

     

     

    The below script works in the context of your form. I don't have access to your data xml file, so I changed "record" to "form", and used the form model instead.

     

    modulo.pagina.Button1[0]::click - (JavaScript, client)

     

    //list.RadioButtonList.nomelist.caption.value.text.value = xfa.record.modulo.list.nomelist.value;

     

    modulo.pagina.Button1[0]::click - (JavaScript, client)

    //list.RadioButtonList.nomelist.caption.value.text.value = xfa.record.modulo.list.nomelist.value;

    var numero = xfa.form.modulo.pagina.list.RadioButtonList.nodes.length;

    app.alert(numero);

    //pippo = new Array;
    for(i=0; i<numero; i++){
    xfa.resolveNode("xfa.form.modulo.pagina.list.RadioButtonList.nomelist[ " + i + "].caption.value.text").value = "New Caption" + (i+1);
    }

     

     

    Result=

     

    New Caption 1

     

     

     

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 17, 2012 9:09 AM   in reply to noos76

    By default, the exclusionGroup is set to layout top to bottom, (layout="tb").

    You can modify the layout such that it becomes

     

    <

    exclGroup name="RadioButtonList" layout="lr-tb

    ">

     

    This will make it layout horizontally.

     

    However, I would wrap the exclusionGroup in a subform, and set the subform to be flowed and western Text (lr-tb). The radiobButtons will be laid out horizontally.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points