Drupal Forms API
This post is about the Form API of drupal6, You may find this post written in a little bit of unimpressive way, this is bcoz i am running short of time these days nonetheless i would like your suggestions and comments at any time and will try to make them happening:
Forms API
- The forms API abstracts forms into a nested array of properties and values.
- $form_values is array which holds form elements values.
- The form token (form unique id) is stored in the variables table as drupal_private_key.
- drupal_get_form() function interact with drupal form.
- hook_elements() function is used to define element type.
- hook_element() can be used to define your own element types in your module.
- element_info() hook collects all the properties for all form elements.
FORM PROPERTIES
- #validate property is used to validate the form elements.
- #base is used to apply same validator to several forms.
- #submit handles form submission. If there is no property named #submit, drupal looks for function name “formID_submit()” or failing that drupal again search for “#basevalue_submit”.
- #after_build property will call all functions of a form.
- #theme is used to set a theme to an existing form.
- #pre_render property used to call the functions just before the transformation of form from a data structure to HTML.
- #prepend, #suffix properties are used to prepend and append text to the form elements. drupal also uses these properties while rendering the form.
- #method property is used to set the form method to post. By default it is set to post, Also get method is not supported by the form API.
- #tree : Setting #tree to TRUE gives a nested array of fields with there values. While #tree is set to FALSE, we get a flattened representation of field name and values.
FLOW of form formation:
when a module contains a form code is called by drupal the form datastructure renders form into html in the following sequence:
call drupal_get_form() -> call hook_elements()['defining element types such as radio buttons, chekcboxes, textfiels'] -> call elements_info() [information about the related properties ,values and functions] -> #validate property -> #submit property
Bibliography: Apress Pro Drupal Devlopement (ycu73k6ath)
Trackbacks and Pingbacks
Comments are closed.
I guess i really wanted to thank you for giving us an idea regarding drupal theme it let us easy to understand the use of it.
Thanks cmsthemer
great post.
Super-Duper website! I am loving it!! Will come back again – taking you feeds also, Thanks.
There’s good info here. I did a search on Google, Keep up the good work mate!
Hello,this is Astrid Prentis,just discovered your Blog on google and i must say this blog is great.may I share some of the Post found in the post to my local buddies?i’m not sure and what you think?in either case,Thx!
This is a great post, I stumbled across your article while looking for some information on SQL. Thanks for sharing, I’ll be sure to come back.
Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.
Thanks you can share this my pleasure
Thanks dude
Cool Thanks
Thanks Will try my best on SQL.
Wow love this blog, looks particularly good in safari for some reason!
Wow! Thank you! I often wanted to write in my web site something like in which. Can I take a part of your post to my weblog?
Great insights. I loved reading this article.
I want to thank you for the endeavors you have made in publishing this article. I am trusting the same best work from you in the future as well
So helpful it seems to me, my luck to read your blog, thank you.
I have got start reading ability including possible types concerning weblogblog site your used jewelry,as well as the i was gday in order to really regularly maintain most blogdog owners words and phrases investigate desire being worthless tutorials,although your own house are generally actually, we not unlike make certain your amazing blog page,as well as a method fully feel fortunate moreover will probably find out things creative,and additionally explain to respect their this page when
Your blog is so informative ¡ keep up the good work!!!!
赞一个 文章写的挺好 支持一下
Thank you so much for so interesting article. Good job!
Greetings! Our staff members are wanting for potential internet writers, would likely you be interested? This method probably will not render you way too rich nonetheless there is an intriguing comp and if you rather love posting then this one opportunity is for you.
I’ve been actually searching for related info. Im lucky I ended up here. Thank you
yes i am interested
Nice list. Definite bookmark!
Thank you for the captivating article, can I ask where you get your information from?
Nice site and great text.
I can’t but agree.I always wanted to write in my site something like that but I guess you’r faster.
Hi buddy, your blog’s design is simple and clean and i like it. Your blog posts are superb. Please keep them coming. Greets!!!
hey there I just wanted to comment your blog and say that I really enjoyed reading your blog post here. It was very informative and I also digg the way you write! Keep it up and I’ll be back to read more soon mate
You got a really useful blog I have been here reading for about half an hour. I am a newbie and your post is valuable for me.
Nice posts here.. danke for writing so much in your blog.. Greets, kesselgulasch gartenparty
Super text, I will add this blog to my favorites.
I am happy to find so many useful information here in the post, we need develop more strategies in this regard, thanks for sharing. . . . . .
interesting post, pretty much covered it all for me, bookmarked.
Really great informative blog post here and I just wanted to comment & thank you for posting this. I’ve bookmarked youi blog and I’ll be back to read more in the future my friend! Also nice colors on the layout, it’s really easy on the eyes.
I’ve read some good stuff here. Definitely worth bookmarking for revisiting.
Cool stuff, thanks for sharing, pretty much on the ball.
Book-marked your website. Thank you for discussing. Definitely worthy of the time far from my tests.
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success.
Idol, great writing, too talented …
Hi. Just did some internet searching and discovered this website. I went through this weblog post and it’s really amazing. I bookmarked it and i am looking forward to your upcoming weblog posts. I also see that your blog has some good linking done to it. I was thinking if you’d like to share your secrets on how to obtain that pr. Anyhow great read again. Amazing info you got here.
Because it is the 1st visit to your webblog, I wanted to say hello there! Wonderful blog incidentally.
Hei, I like this blog, many good information, I want to subscribe it, can anyone help me?
Thanks for good article. Hope to see more soon.
Can you email me back, please. Thank you.
Good post, keep it up!
really nice article. i hope to implement some of these in my blog. thank you!
I agree with the author that we need to share the knowledge we gain!. . . . . .