Closed (fixed)
Project:
Username originality AJAX check
Version:
5.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
29 Aug 2007 at 05:47 UTC
Updated:
2 Jul 2008 at 04:19 UTC
Comments
Comment #1
varr commentedI'm not sure if you ever found an answer to your question but here's how I put the Check Availability button under the username field.
The first thing to note is that, for the most part, unless you have a modified form, the `name` field is going to show up in the `account` fieldset, so it needs to be placed under that fieldset. Then you need to set the weight to match the `name` field's and the response's to +1.
Like so:
Hope that helps!
Comment #2
ardas commentedI think that the best solution to implement this is to override login form theme function and output all fields in their proper positions. You can also implement hook_alter_form in your module to change weight of the username_button and username_message elements.
Comment #3
lgammo commentedHello,
I tried this module, but I found that it has a weird interaction with the CAPTCHA module (version 5.x-3.1). The CAPTCHA module places the captcha just before the lightest button on the form. So whatever you do to place the check username availability button just after the login field, the captcha is gonna butt in between.
Not sure what can be done.
Comment #4
ardas commentedThere are 2 ways to make a form look good:
1. Use hook_form_alter() in your module to assign desired weights.
2. Overload login form theme function and output all elements in a proper manner.
The 1st approach is simpler but the 2d one gives you the most nice form you can have.
Comment #5
Aquilasfx commentedhow to do that:
2. Overload login form theme function and output all elements in a proper manner.
????
Comment #6
ardas commentedCreate function phptemplate_user_login()
and use drupal_render() to output every form element in a proper way
Comment #7
madwalo commentedi'm so sorry i'm so new with drupal so i wan to know where shoul i put this code
function username_check_path_form(&$form) {
// modified the form structure so that these elements get rendered near the actual username form element
$form['account']['username_button'] = array(
'#type' => 'button',
'#value' => t('Check availability'),
'#weight' => $form['account']['name']['#weight']
);
$form['account']['username_message'] = array(
'#type' => 'markup',
'#weight' => (int)$form['account']['name']['#weight'] + 1,
'#prefix' => '
'
);
}
wich file and wich function should call this one?
thanks
Comment #8
ardas commentedThere are 2 proper ways to do it:
1. Override login form theme function and output all fields in their proper positions.
2. You can also implement hook_alter_form in your module to change weight of the username_button and username_message elements.