[development] Adding to Profile forms - is hardcoding the only
way?
Carl Mc Dade
carl_mcdade at yahoo.com
Fri Aug 11 07:10:37 UTC 2006
<?php
function profilecloud_form_alter($form_id, &$form) {
$category = 'Medlemskonventet 2006';
if ($form_id == 'user_edit') {
$alteration = array('#description' => t('ALTERED!!!!'));
//$form[$category]['edit-profile_matchmaking_2006'] = array_merge($form[$category],$alteration);
$form = array_merge($form[$category], $alteration);
}
}
?>
Which produces results while nothing else in the docs or forum worked. The problem is while it does add text to the form it does not alter it. The description stays the same and the added text appears at the top of the form. The second problem is that the extra text seems to exist in its own array and stays at the top. Manipulating the array only moves the profile module fields and leaves the added text at the top.
Everyone says use form _ alter but there is no documentation or examples of its use in the wild. The only way I have been able to get the exact results needed is to hardcode the profile module. Otherwise it does not seem possible. Is it?
Carl Mc Dade <carl_mcdade at yahoo.com> wrote: I am adding a markup field to a Profile form but only want the field to show after a certain textarea. The idea is to use the links in the markup field to enter text in the textarea above it. I have set in the working code and have no problem with it but am questioning the fact that hardcoding this in seems to be the only way.
Is there a way of doing this using the FormsAPI? a grouping syntax? Something like show this field only if a related field is present?
Is there a hook for FormsAPI that would help?
TIA
Carl Mc Dade
____________________________
Web Developer for Hire
http://www.heroforhire.net
info at heroforhire.net
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.
Carl Mc Dade
____________________________
Web Developer
Dataföreningen i Sverige AB
www.d4d.se
www.dfs.se
---------------------------------
Get your email and more, right on the new Yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20060811/70d69010/attachment.htm
More information about the development
mailing list