This page last changed on Aug 17, 2012 by yuriy.kalynovskiy@involver.com.

The do_submit variable inserts the JavaScript which powers the signup form into your tab manually. This is useful for creating custom submit button by replacing {% signup_form_submit %} with an editable image or text anchor based button, like so:

{% editable_image name:"my_button" onsucess:do_submit %}

or

<a href="#_" onclick="{{ do_submit }}" class="my_button">Some text for a button</a>

This is particularly useful when your creatives demand a custom button, when you need to stack multiple functions on the same click, or when you need to nest the form submission into some larger function, such as a Facebook Open Graph call.

{% signup_form %}
    <input type="hidden" name="first_name" id="first_name">
    <input type="hidden" name="last_name" id="last_name">
    <input type="hidden" name="email" id="email">

    {% capture signup_submit %}{{do_submit | replace:"&quot;", "'" }}{% endcapture %}

    {% editable_image name:"submit_button" onclick:"preSignupSubmit();" class="submit" %}
{% endsignup_form %}

<script>
// pulls user info from facebook to populate email, name fields
function preSignupSubmit() {
  FB.login(function(response) {
             if (response.session) {
               if (response.scope) {
                 // user is logged in and granted some permissions.
                 // perms is a comma separated list of granted permissions
                 FB.api('/me', function(response){
                          $("#first_name").val(response.first_name);
                          $("#last_name").val(response.last_name);
                          $("#email").val(response.email);
              {{signup_submit}}
                        });
               } else {
                 // user is logged in, but did not grant any permissions
               }
             } else {
               // user is not logged in
             }
           }, {perms:'email'});
}
</script>

In this example we need to use the replace filter in order to replace the " special characters with literal quotation marks (') so that the capture which is happening in the html function of the page will render correctly in the JavaScript portion of the page.

Document generated by Confluence on Feb 12, 2013 09:09