开发者

Custom drupal form with predetermined values

开发者 https://www.devze.com 2023-01-28 16:54 出处:网络
I need to customise my forms in drupal so that eachfield has a value placed in it using a php script.

I need to customise my forms in drupal so that each field has a value placed in it using a php script.

I have a php script which takes a url and gets a page title and meta description. It'开发者_如何学编程s easy enough to pass these values into a form by placing the required php in the input value. I can do this on a static 'test' form.

However, I'm not sure how to do this with a node form as I don't directly have access to the input value.

Any ideas or solutions would be greatly appreciated.


Use hook_form_alter() in order to alter some existing form entity. A basic knowledge about Form API and module development is sufficient.


I'd suggest using JavaScript to accomplish this since it's very good at manipulating form values (in Drupal too). If you can get the variables in JavaScript then it would be as simple as setting the input id value on page load.

0

精彩评论

暂无评论...
验证码 换一张
取 消