Is it possible to use this module with a custom form template?

bwright - June 27, 2009 - 00:09
Project:Conditional Fields
Version:6.x-1.0-beta1
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I am trying to create a custom template for a CCK form that includes conditional fields. When I do the following in my form template:

print drupal_render($form['controlling_field']);
print drupal_render($form['controlled_field']);

The fields are both rendered just like normal CCK fields--the controlling_field doesn't actually control the visibility of the controlled_field. Is there any way to make this work? THanks for any help.

#1

beauz - July 6, 2009 - 11:07

got the same problem... any answers?

#2

mrthumpz - July 28, 2009 - 15:42

I am having the same issue. I played around with the weights of the modules, but that didn't help. I can get the #conditional-fields info to show in the $form array, but the form is always rendered with all fields visible when using hook_theme() with theme_[contenttype]_node_form()

#3

Dinis - July 29, 2009 - 13:00

You will need to add some logic into your output, an if statement should do.

As a precaution, make sure you save your template to disk before experimenting. If you WSOD your template, you'll have to delete it and start over :)

Hope this helps,
Dani

#4

rburgundy - October 29, 2009 - 17:36

Hi Dinis,

Could you please share an example of adding logic to the rendering of a field on a custom form.
Simply drupal_rendering form fields shows the conditional fields elements in devel but doesn't seem to properly show/hide the field depending on the control field.

Thank you

 
 

Drupal is a registered trademark of Dries Buytaert.