[development] Hidden required select field with default value

Randy Fay randy at randyfay.com
Fri Nov 11 15:54:46 UTC 2011


I think you have to make your own validation function instead of using the
one that comes by default and supports #required.

Use #access (not #hidden) to hide the field.

Then in your validator, check to see whether it's OK that the field is not
filled in, and notify as needed.

-Randy

On Fri, Nov 11, 2011 at 8:50 AM, Idan Arbel <idan at arbel-designs.com> wrote:

> When setting the #type = hidden****
>
> The field is hidden, but when trying to submit the form I get an error
> about the fields being required.****
>
> Looking at the $form dump, I see that the select field has a default
> value. (a term id). ****
>
> I tried changing the Required to false when hiding but then the field
> looses its value.****
>



-- 
Randy Fay
Drupal Module and Site Development
randy at randyfay.com
+1  970.462.7450
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20111111/a0fd413c/attachment.html 


More information about the development mailing list