سؤال

I have 2 radio button groups. The two buttons are radioGroupLoanType and radioGroupLoanType.

The choices for radioGroupLoanType will change depending on the choice in radioGroupLoanType. That works great.

If there is only one choice then the click event of radioGroupLoanType sets the value for radioGroupLoanType. What seems to be happening is the value is only getting set every other click. If I click twice on a selection, then the proper value is set.

What I suspect is happening is the choices for radioGroupLoanType are not being set when the value is set. I can sort of prove this by creating a constant list of values for radioGroupLoanType by using @DbColumn instead of the @DbLookup.

Any other ideas on how to do this?

  <xp:br></xp:br>

<xp:br></xp:br>
<xp:radioGroup id="radioGroupLoanType" layout="pageDirection">



    <xp:eventHandler event="onclick" submit="true"
        refreshMode="complete">
        <xp:this.action><![CDATA[#{javascript:var key =    getComponent("radioGroupLoanType").getValue();
   if (key == null) return;

var val = @DbLookup("","vwRateTypesByLoanTypesOrder",key,"RateName");
if (@IsError(val) || val.constructor == Array)
{   
getComponent("radioGroupRateReq").setValue("");

}
else
{
getComponent("radioGroupRateReq").setValue(val);


}
}]]></xp:this.action>
    </xp:eventHandler>



    <xp:selectItems>
        <xp:this.value><![CDATA[#{javascript:@DbColumn("","vwLoanTypesByOrder",2)}]]></xp:this.value>
    </xp:selectItems>
</xp:radioGroup><xp:br></xp:br>
<xp:br></xp:br><xp:radioGroup id="radioGroupRateReq" layout="pageDirection" styleClass="PNCText">
                <xp:selectItems>
                    <xp:this.value><![CDATA[#{javascript:var key = getComponent("radioGroupLoanType").getValue();
var val = @DbLookup("","vwRateTypesByLoanTypesOrder",key,"RateName");
return (@IsError(val) || val == "") ? @DbColumn("","vwRateTypesByOrder",2) : val;
}]]></xp:this.value>
                </xp:selectItems>

            </xp:radioGroup>
هل كانت مفيدة؟

المحلول

I got this working with scope variables. The onCLick event of radioGroupLoanType sets the choices for radioGroupRateReq and sets the value. radioGroupRateReq usses the selections from the scope variable.

Any better ideas on how to do this?

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top