RE: Can't get round this problem

2008-06-09 Thread Mathias P.W Nilsson

I have googled around for an external form in wicket but havn't found
anything. I've seen some code on using WebMarkupContainer but I can't get
validation to work with that.
-- 
View this message in context: 
http://www.nabble.com/Can%27t-get-round-this-problem-tp17723379p17729068.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Can't get round this problem

2008-06-09 Thread Nino Saturnino Martinez Vazquez Wael
Hmm so you want a form with validation(wicket serverside validation), 
but it should action against an external site? I dont think thats the 
way to go.


Please explain what you are trying todo?


If you are just addend the md5 in a hidden attrib that should be 
trivial, just use a webmarkup container and a attribute modifier. 
Validation should be up to the external site, otherwise you need to 
action against wicket and then if the form is valid then forward the 
request to the other site.. But that seems a bit flaky and very unsecure 
anyway.


Mathias P.W Nilsson wrote:

I have googled around for an external form in wicket but havn't found
anything. I've seen some code on using WebMarkupContainer but I can't get
validation to work with that.
  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: Can't get round this problem

2008-06-09 Thread Sebastiaan van Erk
Don't use a HiddenField on the Wicket side but a WebMarkupContainer. The 
HTML side remains the same (i.e., input tag).


Regards,
Sebastiaan

Mathias P.W Nilsson wrote:

I have a page that has 2 fragment. One for normal ordering and one for credit
card ordering.

When sending the input type hidden names they must have the exact name but
wicket changes it

orderPanel:Merchant_id
must be Merchant_id. How can I remove the orderPanel that adds to the
markup.

I have tried to extend the hidden field and override the protected void
onComponentTag(ComponentTag tag)  but this just makes it work even worse.
Why must wicket change the name of the input tag? Is there a way around
this. I must be able to specify my own name. I was hoping that just

 new HiddenField(  Merchant_id, new Model(   ) ); would do the trick but
wicket changes that name.


smime.p7s
Description: S/MIME Cryptographic Signature


Re: Can't get round this problem

2008-06-09 Thread Mathias P.W Nilsson

I want to populate 15 hidden fileds with data on AjaxSubmitLink( css styled
button ).
There is some validation on the form messaged back to the user using
feedback. If the 
form is correct I want to post to external url. That's it. 


-- 
View this message in context: 
http://www.nabble.com/Can%27t-get-round-this-problem-tp17723379p17730159.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Can't get round this problem

2008-06-09 Thread Nino Saturnino Martinez Vazquez Wael
Okay but the problem is that if you go serverside towards wicket then 
you need to make the user do an extra submit, I guess you could use a 
normal wicket form, then submit via ajax. If validation are okay, return 
another completely hidden form with the values and submit it via the 
client/browser by appending javascript(not sure if some browsers dont 
like this). That should do it, smoothly for the user but not so smoothly 
technically..


Mathias P.W Nilsson wrote:

I want to populate 15 hidden fileds with data on AjaxSubmitLink( css styled
button ).
There is some validation on the form messaged back to the user using
feedback. If the 
form is correct I want to post to external url. That's it. 



  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: Can't get round this problem

2008-06-09 Thread Mathias P.W Nilsson

This is what I do now. When Ajax onSubmit is ok I append a callback that
set's the forms action and post it.

I have also now, changed the name on submit so that works, ( ugly of course
) . Problem is the flickering

I append javascript to the target on AjaxSubmitLink but it makes a sort of
post back first. Because when I empty the cart before submitting the form I
see that the Listview is empty for a second. If I append the javascript in
the decoration sequence then the validation never occurs. 

This will only work if the user have javascript enabled. But I guess most
users do. I understand the problem with external post but I know there are
some wizards out there that could implement this. Maybe in the next wicket
release. External form?
-- 
View this message in context: 
http://www.nabble.com/Can%27t-get-round-this-problem-tp17723379p17730498.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Can't get round this problem

2008-06-09 Thread Nino Saturnino Martinez Vazquez Wael



Mathias P.W Nilsson wrote:

This is what I do now. When Ajax onSubmit is ok I append a callback that
set's the forms action and post it.

  
Hmm okay, not completely what I meant. I'd rater make a clean panel with 
markup containers where you set what you have and append that and submit 
that instead.

I have also now, changed the name on submit so that works, ( ugly of course
) . Problem is the flickering
  
You'll get that because you need double post, you could hide the form on 
submit..

I append javascript to the target on AjaxSubmitLink but it makes a sort of
post back first.

Yes. Because you need the validation to go thru, calling wicket first.

 Because when I empty the cart before submitting the form I
see that the Listview is empty for a second.
Hmm, sounds like something else? Are you having a heartbeat or something 
like it on your page?

 If I append the javascript in
the decoration sequence then the validation never occurs. 
  

No because you need it to first post to wicket.

This will only work if the user have javascript enabled.
Yes hence the javascript and AJAX bit. Otherwise you need for the user 
to click twice, like once for validation and once for the real submit. 
This could be okay too, you could then on the second submit just show 
labels, and write that they now are validated and ask if they are sure 
they want to submit this.

 But I guess most
users do. I understand the problem with external post but I know there are
some wizards out there that could implement this. Maybe in the next wicket
release. External form?
  
Hmm an real external form would not have anything todo with wicket, you 
could just have the form on the page without attaching it to wicket with 
wicket:id's so no need for anything in wicket todo this Or I could 
have gotten it wrong..


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: Can't get round this problem

2008-06-09 Thread Mathias P.W Nilsson

Here is the fragment for sending external data. The form is a class variable
and is visible in the fragment

final class PostenOrderFragment extends Fragment{
private static final long serialVersionUID = 1L;

public PostenOrderFragment( String panel, String id ){
super( panel, id, OrderControl.this );
final PostenOrder order = (PostenOrder) getOrder();
/* Transfer user data. Copy the data from the user to the order 
*/
order.transferUserData( 
((HairlessSession)getSession()).getUser() );


final HiddenField Merchant_id = new HiddenField(  
Merchant_id, new
Model(  ) );
final HiddenField Version = new HiddenField(  Version,   new 
Model( 
));
final HiddenField Customer_refno = new HiddenField(  
Customer_refno, new
Model(   ));
final HiddenField Currency = new HiddenField( Currency, new 
Model( 
));
final HiddenField Amount = new HiddenField(  Amount,  new 
Model(  ));
final HiddenField VAT = new HiddenField(  VAT,   new Model( 
 ));
final HiddenField Payment_method = new HiddenField(  
Payment_method, 
new Model(  ) );
final HiddenField Purchase_date = new HiddenField(  
Purchase_date, new
Model(  ) );
final HiddenField Response_URL = new HiddenField(  
Response_URL, new
Model(  ) );
final HiddenField Card_num = new HiddenField( Card_num,  new 
Model(  )
);
final HiddenField Cvx2 = new HiddenField(  Cvx2,  new Model( 
 ) );
final HiddenField Exp_date = new HiddenField(  Exp_date,  new 
Model( 
) );
final HiddenField Card_type = new HiddenField(  Card_type,  
new Model(
 ) );
final HiddenField MAC = new HiddenField(  MAC, new Model(  
) );
add( Merchant_id );
add( Version);
add( Customer_refno);
add( Currency );
add( Amount );
add( VAT );
add( Payment_method );
add( Purchase_date );
add( Response_URL);
add(Card_num );
add(Cvx2 );
add(Exp_date );
add( Card_type );
add( MAC );




add(new AjaxSubmitLink( placeOrder, form ) {
private static final long serialVersionUID = 1L;

@Override
protected IAjaxCallDecorator getAjaxCallDecorator(){
return new IAjaxCallDecorator(){
private static final long 
serialVersionUID = 1L;
public CharSequence 
decorateScript(CharSequence script)
{
return 
document.getElementById('+ getMarkupId()
+').disabled=true;+script;
}
public CharSequence 
decorateOnFailureScript(CharSequence script)
{
return 
script+document.getElementById('+ getMarkupId()
+').disabled=false;;
}
public CharSequence 
decorateOnSuccessScript(CharSequence script)
{
return 
script+document.getElementById('+ getMarkupId()
+').disabled=false;;
}
};
}

protected void onError(AjaxRequestTarget target, Form 
form){
target.addComponent(feedback);
target.addComponent(form);
   }

@Override
protected void onSubmit(AjaxRequestTarget target, Form 
form ) {

if( target != null ){


target.addComponent(this);
target.addComponent(form);
target.addComponent(feedback);

if( ! 
((Boolean)acceptConditions.getModelObject() ).booleanValue() ){
info( Du måste godkänna 
köpvillkoren );
return;
   

Re: Can't get round this problem

2008-06-09 Thread Nino Saturnino Martinez Vazquez Wael

Okay, im writing inline...

Mathias P.W Nilsson wrote:

Here is the fragment for sending external data. The form is a class variable
and is visible in the fragment

final class PostenOrderFragment extends Fragment{
private static final long serialVersionUID = 1L;

public PostenOrderFragment( String panel, String id ){
super( panel, id, OrderControl.this );
final PostenOrder order = (PostenOrder) getOrder();
/* Transfer user data. Copy the data from the user to the order 
*/
order.transferUserData( 
((HairlessSession)getSession()).getUser() );


final HiddenField Merchant_id = new HiddenField(  
Merchant_id, new
Model(  ) );
final HiddenField Version = new HiddenField(  Version,   new Model( 

));
final HiddenField Customer_refno = new HiddenField(  
Customer_refno, new
Model(   ));
final HiddenField Currency = new HiddenField( Currency, new Model( 

));
final HiddenField Amount = new HiddenField(  Amount,  new Model( 
 ));
final HiddenField VAT = new HiddenField(  VAT,   new Model( 
 ));
		final HiddenField Payment_method = new HiddenField(  Payment_method, 
new Model(  ) );

final HiddenField Purchase_date = new HiddenField(  
Purchase_date, new
Model(  ) );
final HiddenField Response_URL = new HiddenField(  
Response_URL, new
Model(  ) );
final HiddenField Card_num = new HiddenField( Card_num,  new Model( 
 )
);
final HiddenField Cvx2 = new HiddenField(  Cvx2,  new Model( 
 ) );
final HiddenField Exp_date = new HiddenField(  Exp_date,  new Model( 

) );
final HiddenField Card_type = new HiddenField(  Card_type,  
new Model(
 ) );
final HiddenField MAC = new HiddenField(  MAC, new Model(  
) );
add( Merchant_id );
add( Version);
add( Customer_refno);
add( Currency );
add( Amount );
add( VAT );
add( Payment_method );
add( Purchase_date );
add( Response_URL);
add(Card_num );
add(Cvx2 );
add(Exp_date );
add( Card_type );
add( MAC );




add(new AjaxSubmitLink( placeOrder, form ) {
private static final long serialVersionUID = 1L;

@Override
protected IAjaxCallDecorator getAjaxCallDecorator(){
return new IAjaxCallDecorator(){
private static final long 
serialVersionUID = 1L;
public CharSequence 
decorateScript(CharSequence script)
{
return 
document.getElementById('+ getMarkupId()
+').disabled=true;+script;
}
public CharSequence 
decorateOnFailureScript(CharSequence script)
{
return 
script+document.getElementById('+ getMarkupId()
+').disabled=false;;
}
public CharSequence 
decorateOnSuccessScript(CharSequence script)
{
return 
script+document.getElementById('+ getMarkupId()
+').disabled=false;;
}
};
}
  
Im not sure why you need the above, could'nt you just append it to 
target below, and have all code the same place?. I guess I just havent 
used ajaxcalldecorators that much.


protected void onError(AjaxRequestTarget target, Form 
form){
target.addComponent(feedback);
target.addComponent(form);
   }

@Override
protected void onSubmit(AjaxRequestTarget target, Form 
form ) {

if( target != null ){
			
		

target.addComponent(this);
  

Not sure why you need the ajax button added again?

target.addComponent(form);
  
Why do you need the form to be updated? If anything then only the hidden 
field with hash value?


Re: Can't get round this problem

2008-06-09 Thread Mathias P.W Nilsson

Thanks!

I haven't posted all code but there is a check box acceptConditions that
must be clicked to get this to work

How can this be implemented in two forms? I'm not quite following. First I
need to have wicket
check all the data and that the conditions is checked. And then, how can I
submit the other none wicket form?
-- 
View this message in context: 
http://www.nabble.com/Can%27t-get-round-this-problem-tp17723379p17738820.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Can't get round this problem

2008-06-09 Thread Nino Saturnino Martinez Vazquez Wael



Mathias P.W Nilsson wrote:

Thanks!

  

No problem.

I haven't posted all code but there is a check box acceptConditions that
must be clicked to get this to work
  
Okay, but just add that then if it's needed. Always remember when 
working with ajax only to update whats need or you could just use normal 
posting. The idea are to update as little as possible, that will also 
reduce flickering.

How can this be implemented in two forms? I'm not quite following. First I
need to have wicket
check all the data and that the conditions is checked.

I think you got that right:)

 And then, how can I
submit the other none wicket form?
  
Okay then you have a nonvisible non wicket form (yes I know it's not 
very DRY).  You can then set the values in that one instead using your 
javascript, that way you wont be messing with wicket.


Just have the form in the .html and modify your javascript to call that 
one...





--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



RE: Can't get round this problem

2008-06-08 Thread Alex Jacoby
Sounds like you're submitting the info to another website (not back to your 
wicket app), in which case you should just use a plain HTML form (without 
associated wicket form components): wicket won't change the input field names 
then.

Alex

-Original Message-
From: Mathias P.W Nilsson [mailto:[EMAIL PROTECTED]
Sent: Sun 6/8/2008 5:31 PM
To: users@wicket.apache.org
Subject: Can't get round this problem
 

I have a page that has 2 fragment. One for normal ordering and one for credit
card ordering.

When sending the input type hidden names they must have the exact name but
wicket changes it

orderPanel:Merchant_id
must be Merchant_id. How can I remove the orderPanel that adds to the
markup.

I have tried to extend the hidden field and override the protected void
onComponentTag(ComponentTag tag)  but this just makes it work even worse.
Why must wicket change the name of the input tag? Is there a way around
this. I must be able to specify my own name. I was hoping that just

 new HiddenField(  Merchant_id, new Model(   ) ); would do the trick but
wicket changes that name.
-- 
View this message in context: 
http://www.nabble.com/Can%27t-get-round-this-problem-tp17723379p17723379.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



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

RE: Can't get round this problem

2008-06-08 Thread Mathias P.W Nilsson

The hidden fields are set after ajax submit and then I set the action on the
form. I must MD5 some fields before submitting. Why can't this be done in
wicket? 
-- 
View this message in context: 
http://www.nabble.com/Can%27t-get-round-this-problem-tp17723379p17723787.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



RE: Can't get round this problem

2008-06-08 Thread Alex Jacoby
I imagine it can be done, but I don't know how.  You might want to explain more 
about what you're trying to do.

-Original Message-
From: Mathias P.W Nilsson [mailto:[EMAIL PROTECTED]
Sent: Sun 6/8/2008 6:08 PM
To: users@wicket.apache.org
Subject: RE: Can't get round this problem
 

The hidden fields are set after ajax submit and then I set the action on the
form. I must MD5 some fields before submitting. Why can't this be done in
wicket? 

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