Sign up ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Im on d7. I want to have a block on the landing page of my site that has a "enter your title here" input field. When a user enters something in it and clicks continue, they are directed to the node submission form and the title field should be populated with what they had just entered. How would I put something like his together? Thanks?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Use the prepopulate module, there is an example on the docs for prepopulating the title field. All you need is to have a simple form that appends your $data to this path '/node/add/yourcontenttype?edit[title]='.'$data'

share|improve this answer
    
Thank you, I'll check it out!! –  oobie11 Jan 27 '12 at 7:51
    
So I've checked out the prepopulate module and its exactly what I need. I can get it to work for a normal link with some static text, but Im having trouble building a simple form and having it pass the value into the title field. –  oobie11 Jan 30 '12 at 20:14
    
figured it out below –  oobie11 Jan 30 '12 at 20:46

Figured it out. Using the prepopulate module for anyone wanting to do the same thing, here is what my simple form looks like:

<form id="my_form" method="get" action="/node/add/content">
<input name="edit[title]=" type="text">
<button class="submit" type="submit">Go!</button>
</form>

This gets the value of the input and after hitting the submit button, populates the title field of my content type. Im giving credit to @ipwa for directing me to the prepopulate module. Thanks.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.