[support] pop-up register or login form

Don donald at fane.com
Wed Sep 17 05:55:54 UTC 2014


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20140917/a08bb525/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 18361 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/support/attachments/20140917/a08bb525/attachment-0002.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Fane-th.png
Type: image/png
Size: 18361 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/support/attachments/20140917/a08bb525/attachment-0003.png 


More information about the support mailing list