I've one required combobox "PriceList" associated with display error control.
I've anothe field "Price" with OnChange event to set required property of "Pricelist". If price is entered the "Pricelist" combobox required property set to false else on blank, "Pricelist" is enabled.
Both fields and xpage have disabled client validation off.
The combox displays error message in the beginning when document is created. If I change and blanked the value of "price", "pricelist" 's error control does not display message though required property is true.
What is issue here?
Pricelist code:
<xp:comboBox
id="comboBox7"
value="#{document1.PList1}"
style="width:99.0px"
disableClientSideValidation="true">
<xp:this.validators>
<xp:validateRequired
message="Required">
</xp:validateRequired>
</xp:this.validators>
<xp:this.required><![CDATA[#{javascript:var price11:com.ibm.xsp.component.xp.XspInputText = getComponent("price11");
var a=price11.getValueAsString()
if (a == ""){
return true;
}else{
return false;
}}]]></xp:this.required>
<xp:this.disabled><![CDATA[#{javascript:var price11:com.ibm.xsp.component.xp.XspInputText = getComponent("price11");
var a=price11.getValueAsString();
if ( a==""){
return false;
} else {
return true;
}}]]></xp:this.disabled>
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:var result = [];
var pricelist = @DbLookup("" , "Keywords","Price List", 2)
result.push("")
for (var i = 0; i < pricelist.length; i++) {
var eachName = pricelist[i];
result.push(eachName);
}
return result;}]]></xp:this.value>
</xp:selectItems>
</xp:comboBox>
Price code:
<xp:inputText
value="#{document1.Price1}"
id="price11"
style="width:80px"
required="true"
disableClientSideValidation="true">
<xp:this.validators>
<xp:validateRequired
message="Required field">
</xp:validateRequired>
</xp:this.validators>
<xp:eventHandler event="onchange" submit="true" refreshMode="complete">
<xp:this.action>
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:var comboBox7:com.ibm.xsp.component.xp.XspSelectOneMenu = getComponent("comboBox7");
var price11:com.ibm.xsp.component.xp.XspInputText = getComponent("price11");
var a=price11.getValueAsString();
if(a !=="" ){
//if(comboBox7.isRequired()==true){
//comboBox7.setRequired(false);
//}
//var result = [];
//var pricelist = @DbLookup("" , "Keywords","Price List", 2)
//result.push("")
//for (var i = 0; i < pricelist.length; i++) {
//var eachName = pricelist[i];
//result.push(eachName);
//}
//comboBox7.setValue(result);
comboBox7.setRequired(false);
comboBox7.setDisabled(true);
} else {
comboBox7.setDisabled(false);
comboBox7.setRequired(true);
}
}]]></xp:this.script>
</xp:executeScript>
</xp:this.action></xp:eventHandler></xp:inputText>