By FixB on
I am working on a module for which I want the title to be generated by the contect of others fields (for example, Name + Surname).
With Drupal 4.7, I can hide the title, or change the way it is asked in the form. But can I make it an hidden element, automatically generated from the content of other fields ??
Thanks for your help !!
Comments
Maybe my question is not detailed enough ?
Reading again my question, I don't know if it is clear enough.
With Drupal 4.7, the developper has to define the 'title' field in his module's form, as defined here : http://drupal.org/node/22218#node-titles
What I would like to do for my module is not asking the user to fill a 'title' field, but generate the node's title by combining two other fields in the form.
If anyone know how to code such a thing, I would really welcome his help :p
Thanks again !
Please, if you think it is
Please, if you think it is simply not feasible, can someone let me know (so that I don't keep bumping against a wall with no hope :p)
formapi + nodeapi
Warning: hastily pasted code follows!
Your module can use the form_alter hook to hide the title:
and then in the submit case in the nodeapi, you can set $node->title based on any of the attributes in $node.
Thank you very much for your
Thank you very much for your answer.
I'm trying to integrate you example in my code, but at the moment, I can't get it to work properly. It seems that if I edit a node, then I can access the good values and generate my title. But on the creation of the node, I can't access the proper field values.
But I'll keep trying :p Thanks again !!
Thanks for your help. I
Thanks for your help.
I found another solution : I don't put anything in the node->title and change the view of my node : same effect and much more simpler :p