2

I am using Drupal 7, and trying to make a custom register form to fit my needs.

I am also using a contrib module named "Auto Assign Role" to let the user choose his role.

Now heres the issue, the fields are appearing on the form but the order is messed up.

I have 5 fields on the form total:

  1. First Name
  2. Last Name
  3. Role
  4. Username
  5. Password

The first i added via the manage fields section of Account area, the role field is added by the contrib module, and the other two field are built-in, I guess..

Above is the order i seek, but its not doing that even though i think it should. I ordered the field like that in the manage display screen, yet it still doesn't do what i want it to.

The order i get is:

  1. First Name
  2. Role
  3. Last Name
  4. Username
  5. Password

If i set the weight of the above two fields (first & last names) to 0 instead of dragging and dropping to order in the manage display screen i get the following order:

  1. Last Name
  2. First Name
  3. Role
  4. Username
  5. Password

This is almost what i want, but i want first name to be above last name.

Is there some way i can accomplish this?

Thanks!

  • 2
    Try setting -1 to First Name and 0 to Last Name. It should work. – AjitS Apr 20 '14 at 19:18
  • @AjitS Ingenious. Thanks, that worked! If you post a answer below, i happily accept it. – Zubair1 Apr 20 '14 at 19:25
0

@AjitS Credit to you for resolving OP's issues.. Adding more details so that it will be helpful for others..

Drupal weights works using below logic...

Lighter weights Float.... Heavier weights sink...

That means field weight with low value comes to top... Field with Weight high values goes to bottom...

You can also set Negative weights to Fields...

Please find different scenarios of ordered fields with weights below..

Field A : 0

Field B : 1

Field C : 2

Field D : 3

Field E : 4

Field F : 5


Field A : -5

Field B : -4

Field C : -3

Field D : -2

Field E : -1

Field F : 0


Field A : -2

Field B : -1

Field C : 0

Field D : 1

Field E : 2

Field F : 3

In your case Click on Show Row Weights to edit Weights and set weights base on above logic and click save..

enter image description here enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.