I have a form that has a text field and submit button. I want to be able to click the submit button and it opens a modal window with a form - this is all no problem. But I then want to be able to use the data from the text field from the form on the main page, how can I get this?

Any help would be greatly appreciated.

CommentFileSizeAuthor
add.gif1.48 KBmodstore

Comments

merlinofchaos’s picture

Status: Active » Fixed

This is fairly tricky. Generally, what you need to do is have your form submit process (server side) send back commands using ajax_command_replace() or similar to modify the existing page based upon the form submission. If your needs are complex, this can require writing custom commands to do precisely what you need, but I've found that most of the time, rendering what I need on the server and using replace/insert commands does the trick.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jordanmagnuson’s picture

I've got a related issue, but I think I'm wanting to pass data the other way around (from a standard drupal form into a modal when user submits the form: so the modal will say "Hi John" after the user submits the form where they enter their name). I've opened a separate issue at http://drupal.org/node/1556856 . Haven't had much luck getting any responses (it's been weeks), so if either of you have any insight, I'd be really grateful!