Changing checkboxes options during hook_node_validate

Jeff Greenberg <[email protected]> Wed, 11 Feb 2015 09:31:37 -0500
Newsgroups gmane.comp.php.drupal.support
Message-ID <CAPpCgRYHw3z40tnih4Ko=nqKio3HXnViT1fPUGF3Zim-Q3sBvw@mail.gmail.com>
--===============7165827777436275768==
Content-Type: multipart/alternative; boundary=089e013d06e8697c48050ed0dc76

--089e013d06e8697c48050ed0dc76
Content-Type: text/plain; charset=UTF-8

I have a node form that contains a checkboxes field with options NULL at
the time the form is displayed.

During node_validate, if certain criteria is met, an array of options
(checkboxes) is created, and the form needs to be redisplayed with the
checkboxes as part of it.

I've tried setting #options = the new array in the $form, in
$form_state[original_form], etc all to no avail. The field doesn't change.

I also set one checkbox in the field at the start, so that I could find it
in the $form and $form_state structures, changed where I found it to the
new options array, and again, no change. I am setting $form_state[rebuild]
to true, and even tried explicitly calling for the form to be rebuilt.


-- 
---
drupal.org/user/367108
linkedin.com/in/jeffrgreenberg
accidentalcoder.com / ayendesigns.com
@accidentalcoder

--089e013d06e8697c48050ed0dc76
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"" itemprop=3D"text" style=3D"margin:0px 5px =
5px 0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;width=
:660px;word-wrap:break-word;line-height:1.3;color:rgb(68,68,68);font-family=
:&#39;Lucida Grande&#39;,&#39;DejaVu Sans&#39;,&#39;Bitstream Vera Sans&#39=
;,Verdana,Arial,sans-serif"><p style=3D"margin:0px 0px 1em;padding:0px;bord=
er:0px;vertical-align:baseline;clear:both">I have a node form that contains=
 a checkboxes field with options NULL at the time the form is displayed.</p=
><p style=3D"margin:0px 0px 1em;padding:0px;border:0px;vertical-align:basel=
ine;clear:both">During node_validate, if certain criteria is met, an array =
of options (checkboxes) is created, and the form needs to be redisplayed wi=
th the checkboxes as part of it.</p><p style=3D"margin:0px 0px 1em;padding:=
0px;border:0px;vertical-align:baseline;clear:both">I&#39;ve tried setting #=
options =3D the new array in the $form, in $form_state[original_form], etc =
all to no avail. The field doesn&#39;t change.</p><p style=3D"margin:0px 0p=
x 1em;padding:0px;border:0px;vertical-align:baseline;clear:both">I also set=
 one checkbox in the field at the start, so that I could find it in the $fo=
rm and $form_state structures, changed where I found it to the new options =
array, and again, no change. I am setting $form_state[rebuild] to true, and=
 even tried explicitly calling for the form to be rebuilt.</p><div><br></di=
v></div><div><br></div>-- <br><div class=3D"gmail_signature">---<div><a hre=
f=3D"http://drupal.org/user/367108" target=3D"_blank">drupal.org/user/36710=
8</a></div><div><a href=3D"http://linkedin.com/in/jeffrgreenberg" target=3D=
"_blank">linkedin.com/in/jeffrgreenberg</a></div><div><a href=3D"http://acc=
identalcoder.com" target=3D"_blank">accidentalcoder.com</a> / <a href=3D"ht=
tp://ayendesigns.com" target=3D"_blank">ayendesigns.com</a></div><div>@acci=
dentalcoder</div></div>
</div>

--089e013d06e8697c48050ed0dc76--

--===============7165827777436275768==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-- 
[ Drupal support list | http://lists.drupal.org/ ]
--===============7165827777436275768==--