Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

declaritive validation - validwhen

 
Jan Groth
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

i have the following constellation:

a group of three radiobuttons, each of them with a text-field next to it.



if a radio-button is clicked, i need to check that according text field is filled out and contains a valid float. (required, float)

even though "validwhen" looked pretty good on the first glimpse, i'm unable to find out the configuration for my problem.

here the generalized question again:
how can i trigger certain validations in dependence of a test?

thanks a lot for any help,
jan
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:

This will only work if the float check accepts a blank value, which I'm not 100% sure it will. Give it a try anyway. Also, if radio1 is a boolean, substitute radio1 == false in the above code.
[ September 27, 2006: Message edited by: Merrill Higginson ]
 
Jan Groth
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi merril,

thanks for you answer...

this solution does not work... it will start the float validation if the radiobutton is not selected (radio1 == null). this might be tolerable for a float validation, but is not possible for a required validation.

the problem is that with validwhen i can only define a "exit point" before following validations:

( "validwhen, x, y" will not execute x and y if validwhen is not valid)

but i can't seem to write something like validatewhen, which would only execute x and y if validwhen computes to true.

looks like i need to code it by hand,

jan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic