tags:

views:

124

answers:

2

on the onClick event of a button, I'm trying to expose a form (login form) using the Jquery tools Expose (http://flowplayer.org/tools/expose.html) but it doesn't seem to be working ..

 

// execute your scripts when the DOM is ready. this is a good habit
$(function() {

    var api1 = $("#login-area").expose({api:true, lazy:true, color: '#78c'});

});
 

Here is the part I'm trying to Expose

<div id="login-area"> 
   <div class="ttl-area"> 
      <h2 class="ttl-login"><span>Login</span></h2> 
   </div> 
   <!-- start login-area --> 
   <div class="login-area"> 
      <div class="login-holder"> 

         <form Id="loginForm" action="/raceday/Account/Login" method="post"> 
            <fieldset> 
               <label for="UserName" id="UserName_Label">Email:</label><input id="UserName" name="UserName" type="text" value="" /> 
               <label for="LoginPassword" id="LoginPassword_Label">Password:</label><input id="LoginPassword" name="LoginPassword" type="password" value="" /> 
               <div class="row"> 
                  <a href="/raceday/Account/ForgotPassword">Forgot your password?</a> 
               </div><br /> 
               <input class="lock btn" id="Login" name="Login" type="submit" value="Login" /> 
            </fieldset> 
         </form> 
      </div> 

      <strong class="ttl">New user to RacedayWorld.com? Signup below:</strong> 
      <form action="/raceday/Account/Edit" method="get"> 
         <input class="new btn" id="New_User" name="New_User" type="submit" value="New User" /> 
      </form> 
   </div> 
</div>

Here is the call to Expose the element

<input type="button" class="register btn" onclick="api1.load()" value="Sign up for this Event" />
A: 

Make sure:

  • that you include jquery.js
  • that you include expose.js
  • that color should not have a true hexadecima: (aka #78C78C instead of #78C)

Also, don't use inline javascript but specify the onclick inside your main process.

So give your input a unique id:

<input type="button" id="exposeButton" class="register btn" onclick="api1.load()" value="Sign up for this Event" />

$(function(){
var api1 = $("#login-area").expose({api:true, lazy:true, color: '#78c'});
     $('#exposeButton').bind('click',function(){
         api.load();
     });
});
pixeline
Those are included - I just didn't have the space to include everything in the page in the edit window...
Kevin
+1  A: 

you forget to call load() function.

$(function(){

   // note: modify ".login-area" with any element that you want to expose
   var $api1 = $(".login-area").expose({api:true, lazy:true, color: '#78c'});

   // note: modify ".register" with any element that user will click to expose form
   $(".register").click(function(){
      $api1.load()
   });
});
Anwar Chandra
Added that and it adds an overlay element to the entire page on page load...
Kevin
ok. now updated so it add overlay element when you click a button with class '.btn'.
Anwar Chandra
Added the new code you just put in - it calls the expose on the button click which is good, but it exposes the entire page and not the login form (#login-form)
Kevin
change "#login-area" to #login-form
Shadi Almosri
there updated. all you need to do is to modify the selector from "#login-area" to "#loginForm" or any element that you want to expose.
Anwar Chandra
@Q8-coder: this is painful spoon feeding :P
Shadi Almosri
sorry, I didn't mean the actual class #loginform I still want the #login-area to be exposed, I just mean the form which contains the login info.... the class is #login-area but I can't get it to be picked up...
Kevin
sorry, it does sound like spoon feeding, but like I said I actually screwed up the ID name in my last comment so it's still a problem which is not as easy as changing the selector...We've got the expose working on a button click - but the element to expose still remains unsolved! ;)
Kevin
Kevin: classes start with a period (.) and id with a #. Make sure you don't mess them up. Give a unique ID to your login-area if it is meant to be unique.
pixeline
now updated again. as @pixeline explained, classes start with a period. so it should be '.login-form' not '#login-form'
Anwar Chandra
sorry, I mean it should be '.login-area' not '#login-area'
Anwar Chandra
I have actually tried that - I do know the difference .. but it still only displays the expose over the entire page... For some reason, it's just not picking up the element...
Kevin
On further investigation - adding different selectors to expose still overlays on the entire page, so could there be a possibility that there's a different problem .. ?
Kevin