Problem with form submission with callback

2008-05-07 Thread stuffhere

Hi All

I'm trying to submit a form then do a callback to a javascript function, but
the form appears to be submitted twice.

The tapestry form is for login and has a couple of textfields with a
t:submit button



Abridged Java class
@Mixins("t5components/OnEvent")
@Component(id = "loginForm", parameters={"event=submit",
"onCompleteCallback=completeLogin"})
@Persist
private Form loginForm;


public JSONObject onSubmitFromLoginForm() {
System.out.println("\n\nlogging in member ");

JSONObject json = new JSONObject();
String isLoginSuccessful = "false";

LoginDto login = new LoginDto();
login.setUserName(getUserName());
login.setPassword(getPassword());

try {
System.out.println("logging in member " + 
login.getUserName());
loginService.login(login);
securityToken = login.getSecurityToken();
isLoginSuccessful = "true";

} catch (ServiceFaultException e) {
json.put("message", "Login details are incorrect");
}

System.out.println("login is successful " + isLoginSuccessful);
json.put("isLoginSuccessful", isLoginSuccessful);

return json;
}




The javascript function gets called, but is always passed false for
isLoginSuccessful.  When I submit the form (with testuser and password for
the input) I get the following output:

logging in member
logging in member null
[DEBUG] HydraService  logging in member in
service
login is successful false
127.0.0.1 -  -  [07/May/2008:15:24:50 +] "POST
/home.landingpage.loginwidget.loginform:submit HTTP/1.1" 200 69 "-"
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404
Firefox/2.0.0.14"


logging in member
logging in member testuser
[DEBUG] HydraService  logging in member in
service
***creating token
login is successful true
127.0.0.1 -  -  [07/May/2008:15:24:50 +] "POST
/home.landingpage.loginwidget.loginform HTTP/1.1" 200 30 "-" "Mozilla/5.0
(Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404
Firefox/2.0.0.14"

This is the javascript:
function completeLogin(response){
var json = response.evalJSON();
alert(json.isLoginSuccessful);
if (json != null && json.isLoginSuccessful.toString() == 'true') {
gotoHomePage();
}else{
showLoginError();
}
}


Does anyone have any ideas why this is submitting twice.  The first time
doesn't appear to be a proper submit as none of the form fields are being
passed through.

Any help would be greatly appreciated!


-- 
View this message in context: 
http://www.nabble.com/Problem-with-form-submission-with-callback-tp17106416p17106416.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem with form submission with callback

2008-05-07 Thread stuffhere

P.S. I think this is a problem with the onevent stuff - if I just do a normal
submit, the onSubmitFromLoginForm function only gets called once.
-- 
View this message in context: 
http://www.nabble.com/Problem-with-form-submission-with-callback-tp17106416p17106419.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem with form submission with callback

2008-05-07 Thread stuffhere

Ok, I've put some prints in the setters and the form event methods, this is
what I get out:

logging in member
127.0.0.1 -  -  [07/May/2008:17:00:29 +] "POST
/home.landingpage.loginwidget.loginform:submit HTTP/1.1" 200 2 "-"
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404
Firefox/2.0.0.14"
--validate null
--setusername null
--validate null
--setpassword null
--successful null
logging in member
127.0.0.1 -  -  [07/May/2008:17:00:29 +] "POST
/home.landingpage.loginwidget.loginform HTTP/1.1" 200 4 "-" "Mozilla/5.0
(Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404
Firefox/2.0.0.14"

So it appears that the onsubmit method is being called twice, but the form
is only being properly submitted once.  I think the first time the submit
function is called is when I get the javascript callback, which is why I'm
always returned false - the form fields (username and password) are not
being set that time around.  Does anyone know why this is, or how I can fix
it?



-- 
View this message in context: 
http://www.nabble.com/Problem-with-form-submission-with-callback-tp17106416p17109977.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem with form submission with callback

2008-05-08 Thread stuffhere

It was the only way I could think to do the javascript callback - using
onCompleteCallback.  I'm pretty new to Tapestry, so most of what I've done
has been trial and error, is there a better way to do the callback?


-- 
View this message in context: 
http://www.nabble.com/Problem-with-form-submission-with-callback-tp17106416p17123069.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Secure form on a non-secure page

2008-07-31 Thread stuffhere

Hi

I have a login form which appears in the header of my website on non-secure
pages, such as the home and about pages.  This form needs to be secure (post
encryted data), which I think was possible in Tapestry 4 using the scheme
form attribute, but I can't seem to replicate this behaviour in Tapestry 5,
could someone please help me with a solution?

Best regards
-- 
View this message in context: 
http://www.nabble.com/Secure-form-on-a-non-secure-page-tp18750621p18750621.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Tapestry validation not showing

2008-08-27 Thread stuffhere

Hi

This is happening on all forms on my site, in all browsers.

I fill out the form with at least one correct field and one erroneous field
and hit submit - I see the tapestry error bubbles.  I then change the valid
field to be incorrect and without tabbing out of it hit submit - the
validation bubble for that field doesn't seem to display. 

Is this a tapestry bug?  I've been looking into my code and can't seem to
find anything that would cause this behaviour, especially as the bubbles
display the first time around.

 
-- 
View this message in context: 
http://www.nabble.com/Tapestry-validation-not-showing-tp19182664p19182664.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tapestry validation not showing

2008-08-27 Thread stuffhere

Found the cause now - not a tapestry bug :)

stuffhere wrote:
> 
> Hi
> 
> This is happening on all forms on my site, in all browsers.
> 
> I fill out the form with at least one correct field and one erroneous
> field and hit submit - I see the tapestry error bubbles.  I then change
> the valid field to be incorrect and without tabbing out of it hit submit -
> the validation bubble for that field doesn't seem to display. 
> 
> Is this a tapestry bug?  I've been looking into my code and can't seem to
> find anything that would cause this behaviour, especially as the bubbles
> display the first time around.
> 
>  
> 

-- 
View this message in context: 
http://www.nabble.com/Tapestry-validation-not-showing-tp19182664p19182951.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]