[development] wit's end: altering options for an optionwidgets_select element - OR - life without #DANGEROUS_SKIP_CHECK
Gerhard Killesreiter
gerhard at killesreiter.de
Mon Mar 9 23:21:44 UTC 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Harry Slaughter schrieb:
> I want to alter the options for a cck optionwidgets_select element based on data
> in the node itself.
>
> I can't use a function in the cck widget configuration page because that's
> called before the node is loaded, so I don't know what the options should be yet.
>
> I can't do it in hook_form_alter() because optionwidgets_select elements have
> not yet been fully rendered (the actual options for the select have not been set
> yet).
>
> I can make the alteration using #pre_render, but then form validation has run
> already so I've corrupted the form and I fail _form_validate() and get the
> 'illegal choice...' error. And I cannot use the
> drupal_process_form()/drupal_rebuild_form() trick (as seen in AHAH) because the
> #pre_render callback does not have access to $form_state.
>
> I can't use #DANGEROUS_SKIP_CHECK because it has been removed.
Have you considere to add a #process function that runs after the
optionwidget one? Look at the flexifield module how to add one.
Cheers,
Gerhard
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkm1pIcACgkQfg6TFvELooSflQCfR3l1d13rdfaqvM43M5Y4PXZW
jd4AoIYuo3Dgzp+eVBLECh8Hc5Y8AASl
=7cT/
-----END PGP SIGNATURE-----
More information about the development
mailing list