• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

declaritive validation - validwhen

 
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
eat bricks! HA! And here's another one! And a tiny ad!
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic