By Richard Archer on
Is it intended that when you place a markup field inside a collapsible fieldset that the markup is displayed even when the fieldset is collapsed?
If so, how would I place some markup inside the fieldset so that it is only shown when the fieldset is visible?
...Richard.
Comments
Found it
'#type' => 'item'
hijack
since you answered your own question, mind if i ask you one of my own?
could you point me to an example of collapsable fieldsets in use? it sounds like it could be useful at some point
thx
Markup form element broken
The markup element type seems to be buggy in a different way as well. I have several different profile sections that appear on multiple pages. As an example, lets call two of my sections 'Basic Information' and 'Links'. If I use the form alter hook to add markup to my profile edit form like so:
This markup will now appear on every profile edit page, including Edit Account, Edit Basic Information, and Edit Links. Yet my code clearly shows this markup to be within the Basic Information subsection. BUG!
The solution is to use different parts of the Form API. I personally wanted a return to profile link (because of the way my profile edit sections are set up, don't worry about it). So I used #suffix instead, like so:
This will add the link to the end of the fieldset, and bypasses the bugs in the Markup type.
- Ryan
A example, so as it should be
Hello,
Here a example, so as it should be.
you must only change hook_form_alter() to your_module_name_form_alter();
One of two ways
Not really true. You can use either the generic hook_form_alter and include the form id as you posted above, or you can use a specific hook_form_alter with a function name built like so:
modulename + form + form id + alter
In my example, because I was targeting the user_profile_form, my function name ended up being:
mymodulename_form_user_profile_form_alter()
This function successfully added some markup to my form, but using either the markup or item element type gave me the problems I detailed in my post above. Only by adding my markup as a #suffix of an existing element did it work the way I had intended.
- Ryan
Yes you have right, Here a
Yes you have right,
Here a example code I tested and work.
- rendered form in the markup form element
- rendered link
- and rendered html code
Juan Carlos