Re: Using AjaxLink onClick method to retrieve and alter components

2009-02-23 Thread Jeremy Thomerson
If you're using the AjaxLink - it is doing a round trip to the server.  The
problem is, the round trip does not include the form values - because it was
a link - not a form submission.

So, you have two options:

1 - don't use an ajax link - just use a webmarkupcontainer as your a tag
and add the onclick yourself, using javascript like you would on a plain
html page

2 - use an ajaxsubmitlink and do the processing server side

I'd use #2.  Why didn't you want to submit the form?  The user won't be able
to tell the form was submitted - especially if you skip validation by
setDefaultFormProcessing(false) on your ajaxsubmitlink

-- 
Jeremy Thomerson
http://www.wickettraining.com

On Mon, Feb 23, 2009 at 11:17 AM, mallet ryanlahue...@gmail.com wrote:


 Hello, I have been trying for some time to figure this out but no luck.
  Some
 other posts suggest using a submit rather than an AjaxLink, but that will
 not work for me.  Here is my scenario:

 I have two ListChoice objects on my page, one with several items in it and
 the other blank.  I have an AjaxLink button that is visible only when the
 user selects one item from the populated ListChoice.

 When the user clicks an item and the AjaxLink becomes visible, I want them
 to be able to click on the AjaxLink and have the item removed from one
 ListChoice and inserted as an option in the second ListChoice.  However, I
 am not having any luck in the onClick, method of the AjaxLink when I try to
 retrieve the selected item from the original ListChoice.  In fact, I am not
 able to access any items on my page

 I do not want to submit my page or do a post, I simply want to have the
 AjaxLink's onClick do all the work.  Is this possible?  If so, how can I
 retrieve the selected option of a ListChoice called selectBox from within
 the onClick in my AjaxLink?  Every time I attempt to retrieve and cast the
 ListChoice object I get a null value.
 --
 View this message in context:
 http://www.nabble.com/Using-AjaxLink-onClick-method-to-retrieve-and-alter-components-tp22165850p22165850.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Using AjaxLink onClick method to retrieve and alter components

2009-02-23 Thread mallet

Thanks, Jeremy... very helpful.  I didn't quite understand how the
AjaxSubmitLink worked, but on your suggestion I refactored my code and found
it to be exactly what I was looking for.


Jeremy Thomerson-5 wrote:
 
 If you're using the AjaxLink - it is doing a round trip to the server. 
 The
 problem is, the round trip does not include the form values - because it
 was
 a link - not a form submission.
 
 So, you have two options:
 
 1 - don't use an ajax link - just use a webmarkupcontainer as your a tag
 and add the onclick yourself, using javascript like you would on a plain
 html page
 
 2 - use an ajaxsubmitlink and do the processing server side
 
 I'd use #2.  Why didn't you want to submit the form?  The user won't be
 able
 to tell the form was submitted - especially if you skip validation by
 setDefaultFormProcessing(false) on your ajaxsubmitlink
 
 -- 
 Jeremy Thomerson
 http://www.wickettraining.com
 
 On Mon, Feb 23, 2009 at 11:17 AM, mallet ryanlahue...@gmail.com wrote:
 

 Hello, I have been trying for some time to figure this out but no luck.
  Some
 other posts suggest using a submit rather than an AjaxLink, but that will
 not work for me.  Here is my scenario:

 I have two ListChoice objects on my page, one with several items in it
 and
 the other blank.  I have an AjaxLink button that is visible only when the
 user selects one item from the populated ListChoice.

 When the user clicks an item and the AjaxLink becomes visible, I want
 them
 to be able to click on the AjaxLink and have the item removed from one
 ListChoice and inserted as an option in the second ListChoice.  However,
 I
 am not having any luck in the onClick, method of the AjaxLink when I try
 to
 retrieve the selected item from the original ListChoice.  In fact, I am
 not
 able to access any items on my page

 I do not want to submit my page or do a post, I simply want to have the
 AjaxLink's onClick do all the work.  Is this possible?  If so, how can I
 retrieve the selected option of a ListChoice called selectBox from
 within
 the onClick in my AjaxLink?  Every time I attempt to retrieve and cast
 the
 ListChoice object I get a null value.
 --
 View this message in context:
 http://www.nabble.com/Using-AjaxLink-onClick-method-to-retrieve-and-alter-components-tp22165850p22165850.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 
 

-- 
View this message in context: 
http://www.nabble.com/Using-AjaxLink-onClick-method-to-retrieve-and-alter-components-tp22165850p22171907.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org