On 25/09/2007, Josef Chladek <[EMAIL PROTECTED]> wrote: > hello again, > > I use my .yml for existing users to edit their data, except that the > can't change the username, so I do not include that in my config. > if I now want to use the same config for new users to create, I would > need the field username, I can append it to the bottom of the form, > but how would I insert it at the beginning of the form? is there a way?
The way I've dealt with this is by having multiple yaml files. So, if the rest of the fields are in 'user_edit.yml'. Put the username field in 'user_username.yml'. Then create a 'user_existing.yml' that looks something like this: --- load_config_file: - user_username.yml - user_edit.yml Then depending on your need, create your form from either 'user_edit.yml' or 'user_existing.yml'. A completely different alternative is to use insert_before(). This requires you to use auto_fieldset(), or just manually place the fields in a fieldset. Say the first field in the normal form is 'email', then you could do something like this: $fieldset = $form->get_element({ type => 'Fieldset' }); $fieldset->insert_before( HTML::FormFu->new->element({ name => 'username' }), $form->get_field('email') ); But that's pretty nasty, and you'd probably be better of with the first solution :) Carl _______________________________________________ HTML-FormFu mailing list HTML-FormFu@lists.scsys.co.uk http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu