FORUM PLAN UPDATE
Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.



Jun 11, 2012, 11:23 AM
68 Posts

Re: Disabling groups of checkboxes not all. Getting values from documents.

  • Category: Dojo and Client Side JavaScript
  • Platform: All
  • Release: 8.5.3
  • Role: Administrator
  • Tags:
  • Replies: 4
Idea look pretty awsome ! But still nothing in my code:
 
<xp:button value="Button Above Repeat" id="button3">
        <xp:eventHandler event="onclick" submit="false">
            <xp:this.script><![CDATA[var repeat = dojo.byId('#{id:repeat1}');
var list = repeat.getElementsByTagName('input');

for(x in list)
{
   if(list[x].type == "checkbox")
   {
       list[x].disabled = true;
   }
} ]]></xp:this.script>
        </xp:eventHandler></xp:button>
    <xp:br></xp:br><xp:repeat id="repeat1" rows="30" first="0" indexVar="index">

        <xp:this.value><![CDATA[#{javascript:return [0,1,2];}]]></xp:this.value>

        <xp:br></xp:br>

        <xp:text escape="true" id="computedField1">
            <xp:this.value><![CDATA[#{javascript:return "Repeat no: "+index;}]]></xp:this.value>
        </xp:text>
        <xp:br></xp:br><xp:button id="button4">
        <xp:this.value><![CDATA[#{javascript:return "Button Inside Repeat no: "+index;}]]></xp:this.value>
        <xp:eventHandler event="onclick" submit="false">
            <xp:this.script><![CDATA[var repeat = dojo.byId('#{id:repeat2}');
var list = repeat.getElementsByTagName('input');

for(x in list)
{
   if(list[x].type == "checkbox")
   {
       list[x].disabled = true;
   }
} ]]></xp:this.script>
        </xp:eventHandler></xp:button>
        <xp:br></xp:br>
       
        <xp:label id="label1"><xp:this.value><![CDATA[#{javascript:var repeat2:com.ibm.xsp.component.xp.XspDataIterator = getComponent("repeat2");
return getClientId("repeat2");}]]></xp:this.value></xp:label><xp:repeat id="repeat2" rows="30" indexVar="index2">
            <xp:this.value><![CDATA[#{javascript:return [0,1,2,3,4,5,6];}]]></xp:this.value>
<xp:checkBox text="#{javascript:return index2;}" id="checkBox1">


                <xp:eventHandler event="onchange" submit="false">
                    <xp:this.script><![CDATA[//var repeat = dojo.byId('#{id:ta}');
var repeat = "#{javascript:getComponent("label1").getValue();}";
var list = repeat.getElementsByTagName('input');
alert(list);
for(x in list)
{
   if(list[x].type == "checkbox")
   {
       list[x].disabled = true;
   }
} ]]></xp:this.script>
                </xp:eventHandler>

</xp:checkBox><xp:br></xp:br></xp:repeat>
    </xp:repeat>
 
Label  1 holds client ID of repeat2 control ... Same with innerHTML
 
var repeat = dojo.byId("#{id:label1}").innerHTML;
var list = repeat.getElementsByTagName('input');   <--- This dont work
 
Label have value  getClientId("repeat2");

FORUM PLAN UPDATE
Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.