Re: link onClick add panel

2008-03-11 Thread taygolf

Thought I would post back my solution to this problem in case anyone else
needed to do this one day.

I found that I could use the wicket call urlFor to solve my problem.

So I can get the url for the page I want to link to in javascript and then
simply pass that url to the javascript and set it in my link. here is my
code.

PageParameters parameters = new PageParameters();
parameters.put("targetId", targetId);
String url = urlFor(MyPage.class, parameters).toString();
form.add(new AttributeModifier("onsubmit", true, new Model("return
MyJSFunction('"+url+"')")));

This works prefect for what I am wanting to do.

Thanks

T



taygolf wrote:
> 
> I have a problem and I have thought of 2 ways to get it done but I can not
> make either work nor am I sure which one is the best.
> 
> I want the user to be able to add as many customers as they want.
> 
> So I have thought of 2 ways to do this.
> 
> 1) I have a link that when clicked creates a popup with all the necessary
> form fields that need to be filled out to create a customer. When the the
> page is submitted I want the information to be stored on the parent page
> in a table. I also want the customer name to be a link so they can edit
> the customer if need be.
> 
> I have the popup working and collecting all the data but the only way I
> see to get it to put the data on the parent page is with javascript and I
> can not seem to get the customer name to be a wicket link. so I guess the
> problem with this method is how can I get javascript to create a new
> wicket link on the fly or how can I populate the parent page from the
> onSubmit of the form on the popup page.
> 
> 2) I have a link and when that link is clicked it opens a panel with all
> the necessary fields that need to be filled out. For some reason I can not
> get the link to add the panel to the parent page so I am stuck there.
> 
> I would prefer option one because I think it looks cleaner. How can I fix
> these issues? am I thinking in the right direction for what I want to do?
> If not what do I need to be looking at?
> 
> Thanks
> 
> T
> 

-- 
View this message in context: 
http://www.nabble.com/link-onClick-add-panel-tp15860001p15988558.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: link onClick add panel

2008-03-06 Thread Maurice Marrink
So you want option 2,
The popup panel has a model to store the customer entity.
the popup panel probably has a form.
because you only want to refresh part of the parent page the form has
to have an ajax submit
in the submit you add the customer entity or its model to the panel on
the parent page. then add that panel to the ajaxtarget so it will be
refreshed.

Maurice

On Thu, Mar 6, 2008 at 5:13 PM, taygolf <[EMAIL PROTECTED]> wrote:
>
>  This isnt going to work for me. At least I do not think it will. Lets start
>  with the first issue and then move from there.
>
>  The link calls the popup which has a form. when the link is submitted I want
>  to add the customer info to the parent page.
>
>  You suggest storing the info in a database but that will not work for me
>  because they will be adding and deleting these customers a lot and i do not
>  want to have to call the database every time they do this. I would like to
>  pass the info with a model but I can not refresh the parent page because I
>  do not want to lose any information in any other textfield on that page.
>
>  So is there a way I can pass the model to the popup page, add the customer
>  info to the model, and then get that model data to show up on the parent
>  page without a refresh? I have this part of my code in a panel. Can I just
>  refresh the panel without refreshing the whole page?
>
>  After we get this done I would like to make the name of the customer a link
>  but i think I can handle that with no problem in the repeater.
>
>  Thanks
>
>  T
>
>
>
>
>  Mr Mean wrote:
>  >
>  > Assuming you are using a listview or dataview to display all the
>  > customers you can simply add a link to the items, attach a label
>  > displaying the name and you have your clickable name. You could rig
>  > the link to open the popup.
>  > To get the customer data from the popup to the page i would choose to
>  > simply store the customer in the db using a form submit before closing
>  > the popup, from there you can use ajax or a simple setResponsePage to
>  > the parentpage to update its content.
>  > Alternatively if you do not yet want to store your customer you need
>  > to add it to the model of the listview. Note do not replace the
>  > listviews model but do something like
>  > ((List)model.getObject()).add(myCustomer); then you could use either
>  > ajax or setresponsepage to trigger a refresh on the parentpage.
>  >
>  > If you are using ModalWindow as your popup you might need to add a
>  > WindowClosedCallbackHandler to redraw the listview.
>  >
>  > Maurice
>  >
>  > On Wed, Mar 5, 2008 at 9:52 PM, taygolf <[EMAIL PROTECTED]> wrote:
>  >>
>  >>  I have a problem and I have thought of 2 ways to get it done but I can
>  >> not
>  >>  make either work nor am I sure which one is the best.
>  >>
>  >>  I want the user to be able to add as many customers as they want.
>  >>
>  >>  So I have thought of 2 ways to do this.
>  >>
>  >>  1) I have a link that when clicked creates a popup with all the
>  >> necessary
>  >>  form fields that need to be filled out to create a customer. When the
>  >> the
>  >>  page is submitted I want the information to be stored on the parent page
>  >> in
>  >>  a table. I also want the customer name to be a link so they can edit the
>  >>  customer if need be.
>  >>
>  >>  I have the popup working and collecting all the data but the only way I
>  >> see
>  >>  to get it to put the data on the parent page is with javascript and I
>  >> can
>  >>  not seem to get the customer name to be a wicket link. so I guess the
>  >>  problem with this method is how can I get javascript to create a new
>  >> wicket
>  >>  link on the fly or how can I populate the parent page from the onSubmit
>  >> of
>  >>  the form on the popup page.
>  >>
>  >>  2) I have a link and when that link is clicked it opens a panel with all
>  >> the
>  >>  necessary fields that need to be filled out. For some reason I can not
>  >> get
>  >>  the link to add the panel to the parent page so I am stuck there.
>  >>
>  >>  I would prefer option one because I think it looks cleaner. How can I
>  >> fix
>  >>  these issues? am I thinking in the right direction for what I want to
>  >> do? If
>  >>  not what do I need to be looking at?
>  >>
>  >>  Thanks
>  >>
>  >>  T
>  >>  --
>  >>  View this message in context:
>  >> http://www.nabble.com/link-onClick-add-panel-tp15860001p15860001.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]
>  >
>  >
>  >
>
>  --
>  View this message in context: 
> http://www.nabble.com/link-onClick-add-panel-tp158600

Re: link onClick add panel

2008-03-06 Thread taygolf

This isnt going to work for me. At least I do not think it will. Lets start
with the first issue and then move from there.

The link calls the popup which has a form. when the link is submitted I want
to add the customer info to the parent page.

You suggest storing the info in a database but that will not work for me
because they will be adding and deleting these customers a lot and i do not
want to have to call the database every time they do this. I would like to
pass the info with a model but I can not refresh the parent page because I
do not want to lose any information in any other textfield on that page.

So is there a way I can pass the model to the popup page, add the customer
info to the model, and then get that model data to show up on the parent
page without a refresh? I have this part of my code in a panel. Can I just
refresh the panel without refreshing the whole page?

After we get this done I would like to make the name of the customer a link
but i think I can handle that with no problem in the repeater.

Thanks

T


Mr Mean wrote:
> 
> Assuming you are using a listview or dataview to display all the
> customers you can simply add a link to the items, attach a label
> displaying the name and you have your clickable name. You could rig
> the link to open the popup.
> To get the customer data from the popup to the page i would choose to
> simply store the customer in the db using a form submit before closing
> the popup, from there you can use ajax or a simple setResponsePage to
> the parentpage to update its content.
> Alternatively if you do not yet want to store your customer you need
> to add it to the model of the listview. Note do not replace the
> listviews model but do something like
> ((List)model.getObject()).add(myCustomer); then you could use either
> ajax or setresponsepage to trigger a refresh on the parentpage.
> 
> If you are using ModalWindow as your popup you might need to add a
> WindowClosedCallbackHandler to redraw the listview.
> 
> Maurice
> 
> On Wed, Mar 5, 2008 at 9:52 PM, taygolf <[EMAIL PROTECTED]> wrote:
>>
>>  I have a problem and I have thought of 2 ways to get it done but I can
>> not
>>  make either work nor am I sure which one is the best.
>>
>>  I want the user to be able to add as many customers as they want.
>>
>>  So I have thought of 2 ways to do this.
>>
>>  1) I have a link that when clicked creates a popup with all the
>> necessary
>>  form fields that need to be filled out to create a customer. When the
>> the
>>  page is submitted I want the information to be stored on the parent page
>> in
>>  a table. I also want the customer name to be a link so they can edit the
>>  customer if need be.
>>
>>  I have the popup working and collecting all the data but the only way I
>> see
>>  to get it to put the data on the parent page is with javascript and I
>> can
>>  not seem to get the customer name to be a wicket link. so I guess the
>>  problem with this method is how can I get javascript to create a new
>> wicket
>>  link on the fly or how can I populate the parent page from the onSubmit
>> of
>>  the form on the popup page.
>>
>>  2) I have a link and when that link is clicked it opens a panel with all
>> the
>>  necessary fields that need to be filled out. For some reason I can not
>> get
>>  the link to add the panel to the parent page so I am stuck there.
>>
>>  I would prefer option one because I think it looks cleaner. How can I
>> fix
>>  these issues? am I thinking in the right direction for what I want to
>> do? If
>>  not what do I need to be looking at?
>>
>>  Thanks
>>
>>  T
>>  --
>>  View this message in context:
>> http://www.nabble.com/link-onClick-add-panel-tp15860001p15860001.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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/link-onClick-add-panel-tp15860001p15877182.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: link onClick add panel

2008-03-05 Thread Maurice Marrink
Assuming you are using a listview or dataview to display all the
customers you can simply add a link to the items, attach a label
displaying the name and you have your clickable name. You could rig
the link to open the popup.
To get the customer data from the popup to the page i would choose to
simply store the customer in the db using a form submit before closing
the popup, from there you can use ajax or a simple setResponsePage to
the parentpage to update its content.
Alternatively if you do not yet want to store your customer you need
to add it to the model of the listview. Note do not replace the
listviews model but do something like
((List)model.getObject()).add(myCustomer); then you could use either
ajax or setresponsepage to trigger a refresh on the parentpage.

If you are using ModalWindow as your popup you might need to add a
WindowClosedCallbackHandler to redraw the listview.

Maurice

On Wed, Mar 5, 2008 at 9:52 PM, taygolf <[EMAIL PROTECTED]> wrote:
>
>  I have a problem and I have thought of 2 ways to get it done but I can not
>  make either work nor am I sure which one is the best.
>
>  I want the user to be able to add as many customers as they want.
>
>  So I have thought of 2 ways to do this.
>
>  1) I have a link that when clicked creates a popup with all the necessary
>  form fields that need to be filled out to create a customer. When the the
>  page is submitted I want the information to be stored on the parent page in
>  a table. I also want the customer name to be a link so they can edit the
>  customer if need be.
>
>  I have the popup working and collecting all the data but the only way I see
>  to get it to put the data on the parent page is with javascript and I can
>  not seem to get the customer name to be a wicket link. so I guess the
>  problem with this method is how can I get javascript to create a new wicket
>  link on the fly or how can I populate the parent page from the onSubmit of
>  the form on the popup page.
>
>  2) I have a link and when that link is clicked it opens a panel with all the
>  necessary fields that need to be filled out. For some reason I can not get
>  the link to add the panel to the parent page so I am stuck there.
>
>  I would prefer option one because I think it looks cleaner. How can I fix
>  these issues? am I thinking in the right direction for what I want to do? If
>  not what do I need to be looking at?
>
>  Thanks
>
>  T
>  --
>  View this message in context: 
> http://www.nabble.com/link-onClick-add-panel-tp15860001p15860001.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]