I want to load a field form belong to the entity,and update the value
For example, i want to let the user change his email field value independently,
this is say, the user can visit a page to see only the email field form,and update the value,
or just load the user's introduction field form,and save it to update the user's introduction field value.
or just load a node's og group field form, and update the node's og group value.not need to manually build a new form and to validate and submit the value.
I mean not need to manually build a new form and new validate and new submit to handle the data,just load the user email form ,and save it to update the user's email value.
How can i do like that?thanks for all advise!!!It can save my time so much!!!
Comments
That is not a feature of
That is not a feature of Drupal, you would need custom forms for such functionality.
When you create the form, you
When you create the form, you need to pass it a complete $account object:
Then, in your form definition, you pass the $account object through to your submit function:
Thanks so much for your
Thanks so much for your advise,Jaypan
You show me a clean entire way to do it, it is a good idea,
yesterday i google a another way to do it like below, and it can save many time when solve on complex field form ,what do you think about this?
but now,when i add a submit button,it locate above the field form,how to make it under the field form?
You can do that as well. I
You can do that as well. I prefer my method, but both will (should) work.
Thanks for you reply so
Thanks for you reply so quickly,
but now,when i add a submit button,it locate above the field form,how to make it under the field form?
I don't see a submit button
I don't see a submit button in your code.
But you can probably change it using #weight.
<?phpfunction my_awesome_form
this is my code with submit button,
the button will display above the field form,how to put it under the field form?
i user form['weight'],but it seems don't work.
haha,thanks so so so much,
haha,thanks so so so much,
It work!
with #weight property add to it
Thank you so much, Jaypan,
Thank you so much, Jaypan, with my full heart gratitude !you save my so a lot of time.
1.module_load_include('inc', 'comment', 'comment.pages');
2.clean entire way to do field form and update value
3.form #weight,ever make me thought of how to solve it.
Looking for the same :)
++