Closed (fixed)
Project:
Conditional Fields
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Aug 2011 at 04:18 UTC
Updated:
12 Sep 2011 at 23:21 UTC
Hey,
Awesome totally functioning module in D7!
Just wondering if there is a way to have this setup for custom forms that we create ourselves. Rather than creating a new content type I have a custom form that I would like to use with this module. Is it possible to do that in some way? I couldn't find it anywhere in the documentation and could really use your help.
Comments
Comment #1
nevets commentedYou actually do not need this module for forms produced with the form API.
If you look at the examples module it includes a number of ajax examples including how to hide/unhide form fields based on another form fields value.
You might also read Render Arrays in Drupal 7 and "Franz Heinzmann's session on the Render API in Drupal 7 at Drupalcon Chicago" under resources is worth the time to watch.
Comment #2
shaneonabike commentedOk cool ... thanks for that!
Comment #3
shaneonabike commentedPS - I did actually get something working by coping the structure you had b/c I needed to rip a section out of our user form and place that in a popup for anonymous users. But probably not that relevant here.
Comment #4
peterpoe commentedHere is some example code for an hypothetical "conditional_fields_example" module that you can use to learn how to attach a dependency to any form built with the Forms API. It needs the latest dev version to work.
Of course using this makes sense only if you want to create complex dependencies without going crazy with the States API and/or want to use Conditional Fields built in systems for animation effects, dependency triggering evaluation, and so on.
More documentation is needed, but this is a good start for anyone daring to dig in.