Hi all,

I'm using the markup field to insert some javascript to auto-populate a select list.

The problem is that the automatic validation of webforms, won't accept the new values that are inserted.
Is there a way to turn off the automatic validation? Or am I going to have to hack webforms(I've managed to stay away from this so far, so I'd prefer not to)

Thanks in advance for the help.

Comments

alexfisher’s picture

subscribe

quicksketch’s picture

No, it's not possible to modify a form's HTML through JavaScript (or any other means, like Firebug, or editing the source, etc). Drupal's built-in security mechanisms prevent values from being added to select lists. Alternatively, you can start out with a text field rather than a select list, then convert it to a select list through JavaScript. Since textfields do not have any security checking of values, you can enter any values you like.

quicksketch’s picture

Title: Weforms-Stoping built in validation » Add Custom Values through JavaScript

Just updating title for reference.

Psycnic’s picture

Thanks for the help.
What I decided to do was use javascript to update a hidden field, on change of the select list. And then when the submit button is clicked, reset the value of the select box.

quicksketch’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.