hi, I'm trying to do a little pop-up form linked to a download button to have a visitor register before downloading a document. This is part of a D7 upgrade of the site, and i was using the popups module before.
Now I'm using the popup module, which works fine. But i can't get the submit handler to work via ajax. I know it's supposed to be really easy and in core now, but i'm wondering what i'm missing. I get a full post and page refresh every time i hit the button.
Here's what i've got on the login form. I show both forms, though they're actually separate. I'm guessing i'm just sleepy enough i'm missing something simple.
The form validate just looks up the email in a table and sees if they're already registered. If they are, the link to the pdf is added to the download button.
function myform(){ $form['guest_email'] = array( '#type' => 'textfield', '#default_value' => t('Email Address'), '#size' => 60, '#maxlength' => 60, '#attributes' => array('class' => 'defaultText', 'onClick' => "SelectAll('edit-guest-email');"), '#required' => TRUE, ); $form['submit'] = array( '#type' => 'submit', '#value' => t('Download'), '#ajax' => array( 'callback' => 'custom_login', 'wrapper' => 'inner', 'method' => 'replace', 'effect' => 'fade', ), ); return $form; }
Thanks.