Re: pop-up register or login form

Don <[email protected]> Wed, 17 Sep 2014 01:55:54 -0400
Newsgroups gmane.comp.php.drupal.support
Message-ID <[email protected]>
Follow-up question. It turned out the popup module loading the form via 
ajax meant that the event handler for the submit button was never 
registered.
Does anyone know if there's a way to add the click event when a form is 
loaded well after DOM load?

Thanks.
-Don-

> 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.
>
> -- 
> -Don Pickerel-
> Fane Software
>


-- 

-- 
-Don Pickerel-
Fane Software

-- 
[ Drupal support list | http://lists.drupal.org/ ]