How do you change weights without crashing form
electronicmonkey - April 11, 2008 - 10:07
| Project: | Form Defaults |
| Version: | 5.x-2.0 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
This works well and changing form field labels is a breeze , but when I try to move the fields around , for example moving X field (weight 5) to (weight -5) where Y field is .I find that X field completely replaces Y field which vanishes and I have two X fields (weight 5 and -5) .
Can you give an idiot proof step by step for changing weights

#1
I have added new fields to registration form. How can I use this to rearrange the fields seeing that the registration form is not visible to site administrator ?
#2
I don't have a great answer here given that formdefaults can't know about a form that isn't rendered. There's no registry. I don't know how comfortable you'd be with this, but yoiu could temporarily grant the privelege to anonymous users, make the changes and then set it back.
#3
Regarding the original issue, I can't reproduce this. All of my forms do not behave this way. I regularly re-order forms simply by changing weights, altough when modules don't set weights to begin with, they may not sort the way you think they should.
I have never seen a formdefaults module duplicate a form field. Can you reproduce this on other forms?
#4
I am also experiencing the same problem that electric monkey mentions in the original post. I am trying to edit an event add form that has CCK fields added to it. When i changed the weight on one of the CCK fields it overwrote another CCK field that was already there. Now that other CCK field doesn't show at all and the original CCK field whose weight i changed shows up twice. Even if i click "hide" it still is shown on the form.
These fields, however, show up properly with the correct weights on the content type edit fields under "manage fields"
#5
Still having trouble reproducing this. I created a new content type, added a text field to it, using cck and then went and reordered the fields by adjusting weights. Everything worked as advertized. Is there any chance that there are other modules that do form alterations that might be in play here?
Could we start collecting info on modules in use, drupal versions, etc?
Happy to continue to help, but am feeling a bit stumped as to what direction to move in. Would someone be willing to try the 5.x dev version to see if the problem still exists. I can't think of any major differences there, but it might be worth a try.
Could someone post a detailed way of reproducting this problem?
#6
I think to reproduce this, one needs to add more than one text field, as in my case, i found that one CCK field was overwriting another.
I am using D5.7 and do not have any other form alteration modules installed.
I was using the event module content type and added 2 node reference fields, 1 user reference field, 1 image field and 1 text field. Plus there were 3 taxonomy fields and the group audience fields existing in the event form before i started editing it. (So it was quite full).
First, i started using the form default module to change some of the directions on the various fields and then i started trying to move them around by adjusting weights. I believe that it was a node reference field that overwrote a text field. The node reference field was then listed twice and the text field was missing. I went into manage fields and deleted both of the fields and tried adding them back. However, still both fields showed up with the title of the node reference field. I had to disable the form defaults module (from admin/build/modules) to delete and completely rebuild the two fields.
But after playing around with it a bit further, i realized that in fact, the node ref field had only overwritten the title on the form (of the text field) and that if i looked into the manage fields view, the field remained in it's original form. So i only needed to edit the title of the field on the actual form (using form default).
I also found that if i tried to add another field while form default was enabled, the new field would also overwrite another existing field. But if i added an additional field with form default disabled, then i could easily add the additional field. It seems that CCK will graciously accomodate two fields with the same weight, whereas form default will not.
Also, i found that i could not change the weight of the body field. This seems to stay fix at 0. (Perhaps this is not editable?)
Sorry, i'm hopeless with the code, but i hope this helps to isolate the cause of the issue.
Otherwise, i find it quite a handy module. Thanks for the great work!
#7
One way that I might be able to figure out how to reproduce this is for you to post or email me the exported content type. I might be able to test this in this way. Would that be possilble?
#8
Okay, here is the exported view. Not sure how it will work. When i exported it i received the following message:
"Venue: This post can't be referenced
The default value is invalid"
$content[type] = array ('name' => 'Event',
'type' => 'event',
'description' => 'An event is a story which can be given a start and end date, thus appearing in the events calendar.',
'title_label' => 'Title',
'body_label' => 'Event Description',
'min_word_count' => '0',
'help' => 'PLEASE COMPLETE THIS FORM TO INCLUDE ALL RELEVANT INFORMATION ABOUT THE EVENT.
TO OFFER EVENT ATTENDEES THE OPPORTUNITY TO REGISTER FOR THE EVENT, CLICK ON "SIGNUP SETTINGS AT THE BOTTOM OF THE FORM.
IF YOU HAVE ADDITIONAL PAPERS OR INFORMATION THAT YOU WOULD LIKE TO INCLUDE AS AN ATTACHMENT, PLEASE UPLOAD THE DOCUMENT AT THE BOTTOM OF THE FORM AT "FILE ATTACHMENTS".
AFTER COMPLETING THE FORM, BE SURE TO CLICK THE "SUBMIT" BUTTON AT THE BOTTOM OF THE PAGE.',
'node_options' =>
array (
'status' => true,
'promote' => false,
'sticky' => false,
'revision' => false,
),
'comment' => '0',
'upload' => '1',
'event_nodeapi' => 'all',
'image_attach' => '0',
'image_attach_size_teaser' => 'thumbnail',
'image_attach_weight_teaser' => '0',
'image_attach_size_body' => 'thumbnail',
'image_attach_weight_body' => '0',
'signup_node_default_state' => 'allowed_off',
'old_type' => 'event',
'orig_type' => 'event',
'module' => 'node',
'custom' => '0',
'modified' => '1',
'locked' => '1',
'reset' => 'Reset to defaults',
'ant' => 0,
'ant_pattern' => '',
'ant_php' => 0,
'links_related_types' => '0',
'taxonomy_context_inline' => '0',
'taxonomy_context_breadcrumb' => '0',
);
$content[groups] = array (
0 =>
array (
'label' => 'Event Photo',
'settings' =>
array (
'form' =>
array (
'style' => 'fieldset',
'description' => '',
),
'display' =>
array (
'description' => '',
'teaser' => 'fieldset',
'full' => 'fieldset',
'label' => 'hidden',
),
),
'weight' => '-10',
'group_name' => 'group_event_photo',
),
);