views:

126

answers:

2

I'm looking to add some speacial validation with webform through Drupal. It seems the old forms you could add extra PHP code to "Advanced Settings". According to this link we shouldn't be doing this anymore. (Running Drupal 6)

What I have is a check box that makes a few fields disappear and a few different fields appears. So for my validation I need to validate only the fields that are "present" depending on if the checkbox is checked or not. (Make them disappear/reappear with JQuery). The last step is to change the validation code.

I looked into the webform validation module, but it doesn't seem to hold what I need since I can't specify specific fields based on a checkbox.

How would I go about doing this?

+1  A: 

With hook_form_alter you can add your own validation handler to the webform where you can validate the data as you like.

googletorp
it might not be obvious to the poster, but this would cause the validation to be checked on the server, any clientside validation would still be in effect.
Al W
Sorry i'm new to drupal, I'll look into the hook_form_alter. Thanks! Does the current webform validation occur on the server side or client side?
John Ruppet
I wrote the hook_form_alter, but I can't seem to get any vlaues from the $form_values? $form_values['submitted_tree']['Name']['Name'] comes back as nothing? Any suggestions if anybody is still listening :p
John Ruppet
A: 

Have you considered using the http://drupal.org/project/webform_conditional module? (requires webform ver 3). It avoids the use of custom jquery and might work better better with webform validation module.

Sid NoParrots