This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Feb 29, 2012, 12:06 PM
45 Posts
topic has been resolvedResolved

Combo Box Validation using number.

  • Category: Other
  • Platform: All
  • Release: 8.5.3
  • Role: End user
  • Tags:
  • Replies: 2
Hi
 
I have a Combo Box with a selection of 'blank', ie a space in the label and nothing in the value plus numbers 1 - 10,- i.e. a simple scoring form, - which is bound to a number field in a back end document.
 
If I set the Combo Box to String, Validation (Required) does not work.
If I set a convertor on the Combo Box to Number then when the page is submitted I am returned the following runtime error after selecting a value.
 
java.lang.NumberFormatException: empty String
empty String.

Any help would be appreciated.


 
 
 
  
Feb 29, 2012, 1:43 PM
56 Posts
Re: Combo Box Validation using number.
Hello Mark,
 
ok, with the number evaluator, it is logical that he crashes (shouldn't be, but that's another story)
I can't explain why the required evaluator shouldn't work..
 
 If there is no solution, you could attach the validation to another field with a validate expression and check whether this field is empty or not.
Alternatively, you could write an InputValidation formula in the form of the document. In server-side validation, the results of an inputValidation will be passed through into the XPage and displayed in a messages block.
 
Hope this helps.
Feb 29, 2012, 3:44 PM
45 Posts
Re: Combo Box Validation using number.
Many thanks Matthius
 
Based on what you wrote I added a  Validate Expression which works fine...
 <xp:this.validators>

<xp:validateExpression

message="Please enter a score above">

<xp:this.expression><![CDATA[#{javascript:score =@TextToNumber(getComponent("comboBox7").getSubmittedValue());

if (score <1){return false;}

else

{return true;}}]]></xp:this.expression>

</xp:validateExpression>

</xp:this.validators>


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal