我想做到的是 每题没有做出(1,2,3,4,5分)选择时弹出提示框,否则不能保存?

这是几道选择题,每题有相应的1,2,3,4,5分,

<mx:GridRow width="100%"
height="28"
id="oldInfo2">
<mx:GridItem paddingLeft="5"
colSpan="5"
borderStyle="solid"
verticalAlign="middle"
horizontalAlign="left">
<s:Label text="one"/>
</mx:GridItem>
<mx:GridItem id="Q1"
borderStyle="solid"
paddingLeft="2"
verticalAlign="middle">
<s:HGroup width="100%" horizontalAlign="center" verticalAlign="middle">
<s:RadioButton groupName="first" value="1" />
<s:Label text="1分" ></s:Label>
</s:HGroup>
</mx:GridItem>

<mx:GridItem id="Q2"
borderStyle="solid"
paddingLeft="2"
verticalAlign="middle">
<s:HGroup width="100%" horizontalAlign="center" verticalAlign="middle">
<s:RadioButton groupName="first" value="2"/>
<s:Label text="2分" ></s:Label>
</s:HGroup>
</mx:GridItem>

<mx:GridItem id="Q3"
borderStyle="solid"
paddingLeft="2"
verticalAlign="middle">
<s:HGroup width="100%" horizontalAlign="center" verticalAlign="middle">
<s:RadioButton groupName="first" value="3"/>
<s:Label text="3分" ></s:Label>
</s:HGroup>
</mx:GridItem>

<mx:GridItem id="Q4"
borderStyle="solid"
paddingLeft="2"
verticalAlign="middle">
<s:HGroup width="100%" horizontalAlign="center" verticalAlign="middle">
<s:RadioButton groupName="first" value="4"/>
<s:Label text="4分" ></s:Label>
</s:HGroup>
</mx:GridItem>
<mx:GridItem id="Q5"
borderStyle="solid"
paddingLeft="2"
verticalAlign="middle">
<s:HGroup width="100%" horizontalAlign="center" verticalAlign="middle" >
<s:RadioButton groupName="first" value="5"/>
<s:Label text="5分" ></s:Label>
</s:HGroup>
</mx:GridItem>
</mx:GridRow>

if(!ProcessDataUtil.validateRadioButton(first))
{
Alert.show("信息不能为空");
return false;
}



拉丁的传说
浏览 88回答 1
1回答

三国纷争

//这个我知道的有两个方法..第一个这些控件都在相同的步局控件中.那么咱们循环布局控件实现//你的代码也没给全我只能大概给你个思路.for&nbsp;each(var&nbsp;obj:Object&nbsp;in&nbsp;hbox.getChildren()){//比如现在是hbox..不管是啥...&nbsp;&nbsp;&nbsp;&nbsp;if(obj&nbsp;is&nbsp;Grid){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;each(var&nbsp;row:GridRow&nbsp;in&nbsp;grid.getChildren()){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;each(var&nbsp;item:GridItem&nbsp;in&nbsp;row.getChildren()){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;group:HGroup&nbsp;=&nbsp;item.getChildren()[0];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;radio:RadioButton&nbsp;=&nbsp;group.getChildren()[0];//group里第一个就是单选&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//判断是否选中..选中就跳下个循环;我就不写了..因为没看到你的radioGroup....就是first...就随便写个意思..你懂就行了..哈哈&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(radio.selected){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;}}//这个方法就是直接取radioGroup;但是取名给radioGroup给ID的时候...是加上索引的..比如group1,group2.group3....等等;/那么看有几题直接循环for(var&nbsp;i:int&nbsp;=&nbsp;1;i<=题数;i++){&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;radioGroup:RadioGroup&nbsp;=&nbsp;this["group"+i];//直接通过ID取页面上的radioGroup&nbsp;&nbsp;&nbsp;&nbsp;if(radioGroup.selectedvalue!=null&nbsp;||&nbsp;!=""){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//做你的判断就行...大概思路就是这些吧...你自己补全&nbsp;&nbsp;&nbsp;&nbsp;}}
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Html5