How do I change the order of the form elements? 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:


First Name
Last Name
Role
Username
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:


First Name
Role
Last Name
Username
Password


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


Last Name
First Name
Role
Username
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!
@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..