You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jeremie <js...@outlook.com> on 2013/08/07 13:09:11 UTC

Wicket: DropDownChoice onChange open response page in right frame

Hello,

In my research project, I need to create a combo box with a list of choices.
I use AJAX and DropDownChoice to perform some action on selection change. My
application is based on the frames example on Wicket's website:
http://www.wicket-library.com/wicket-examples/frames/

When the user selects a choice in the combo box, I use PageParameters to
pass in the value of the selected choice to another Java/Wicket class I
created that will query values from a db based on the selected value and
will create a Highcharts graph in the right frame (the main frame).

At this point, when I change the combo box selection, the graph opens, but
in the left frame (or left menu bar if you prefer) instead of the main body
(right frame). With anchor tags, I can specify the HTML target attribute
with the value "right" ( </a> <#> ) and this ensures my response page opens
in the right frame, but my dropdown choices are not links.

Here is my code that calls the response page with the parameters (ddSkills
is a DropDownChoice object):

	// pass selected skill value on to graph page
            ddSkills.add(new AjaxFormComponentUpdatingBehavior("onchange") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                    PageParameters pageParameters = new PageParameters();
                    pageParameters.add("skill", selectedSkill);
                    setResponsePage(TraineesView.class, pageParameters);
                }
            });

My questions is: how can I tell Wicket I want the response page to open in a
new tab, or in my case the right frame, using PageParameters, or any other
way I might not have figured out? Is is feasible using the values of a combo
box or should I try using RepeatingView or ListView to make my "options"
links, in which case I could perhaps add the target attribute. 

Thanks for your help,

Jeremie




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-DropDownChoice-onChange-open-response-page-in-right-frame-tp4660763.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Wicket: DropDownChoice onChange open response page in right frame

Posted by Jeremie <js...@outlook.com>.
In fact, pageURL returns nothing.



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-DropDownChoice-onChange-open-response-page-in-right-frame-tp4660763p4660771.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Wicket: DropDownChoice onChange open response page in right frame

Posted by Jeremie <js...@outlook.com>.
Thanks both for your quick replies.

What does top refer to? In my page, I have the following structure:

Home.html 

<frameset rows="175px, *" name="master"
xmlns:wicket="http://wicket.apache.org">
               <frame wicket:id="topFrame" name="top" />
               <frame wicket:id="bodyFrame" name="body"/>
</frameset>

Home.java

public class Home extends WebPage
{
               /** */
               private static final long serialVersionUID = 1L;

               /**
               * Constructor
               */
               public Home()
               {
            IRequestHandler topFrameHandler = new
BookmarkablePageRequestHandler(new PageProvider(
                    TopFrame.class));
            ExampleFrame topFrame = new ExampleFrame("topFrame",
topFrameHandler);
            add(topFrame);

               // TopFrame.class is all right, so I don’t bother with it.

            IRequestHandler bodyFrameHandler = new
BookmarkablePageRequestHandler(new PageProvider(
                    BodyFrame.class));
            ExampleFrame bodyFrame = new ExampleFrame("bodyFrame",
bodyFrameHandler);
            add(bodyFrame);
               }
               // BodyFrame.class contains the left and right frames I am
concerned about.
}

BodyFrame.java

public class BodyFrame extends WebPage
{
               /** */
               private static final long serialVersionUID = 1L;

               private final FrameTarget frameTarget = new
FrameTarget(IntroPage.class);

               /**
               * Constructor
               */
               public BodyFrame()
               {
                              // create a new page instance, passing this
'master page' as an argument
                              LeftFrame leftFrame = new LeftFrame(this);
                             
getSession().getPageManager().touchPage(leftFrame);
                              // get the url to that page
                              IRequestHandler leftFrameHandler = new
RenderPageRequestHandler(new PageProvider(leftFrame));
                              // and create a simple component that modifies
it's src attribute to
                              // hold the url to that frame
                              ExampleFrame leftFrameTag = new
ExampleFrame("leftFrame", leftFrameHandler);
                              add(leftFrameTag);

                              ExampleFrame rightFrameTag = new
ExampleFrame("rightFrame")
                              {
                                            /** */
                                            private static final long
serialVersionUID = 1L;

                                            protected CharSequence getUrl()
                                            {
                                                           return
frameTarget.getUrl();
                                            }
                              };
                              add(rightFrameTag);
               }

               /**
               * Gets frameTarget.
               * 
                * @return frameTarget
               */
               public FrameTarget getFrameTarget()
               {
                              return frameTarget;
               }

               /**
               * @see org.apache.wicket.Component#isVersioned()
               */
               @Override
               public boolean isVersioned()
               {
                              return false;
               }
}

BodyFrame.html

<frameset cols="350px, *" name="master"
xmlns:wicket="http://wicket.apache.org">
               <frame wicket:id="leftFrame" src="[set by index]" name="left"
/>
               <frame wicket:id="rightFrame" src="[set by index, modified by
left frame]" name="right" />
</frameset>

I tried the code you provided, but it did not work. Here is the JS code I
tried:

// pass selected skill value on to graph page
            ddSkills.add(new AjaxFormComponentUpdatingBehavior("onchange") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                    PageParameters pageParameters = new PageParameters();
                    pageParameters.add("skill", selectedSkill);
                    CharSequence pageURL = urlFor(TraineesView.class,
pageParameters);
                    
                   
target.appendJavaScript("window.frames['body'].frames['right'].location=" 
                            + pageURL + ";");
                }
            });

Based on the code I provided, is this JS code supposed to work? I add this
code inside LeftFrame.java/.html, and I want to reference the html of
BodyFrame.

Thanks again,

Jeremie




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-DropDownChoice-onChange-open-response-page-in-right-frame-tp4660763p4660770.html
Sent from the Users forum mailing list archive at Nabble.com.

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


RE: Wicket: DropDownChoice onChange open response page in right frame

Posted by Jeremie <js...@outlook.com>.
Thanks both for your quick replies.

 

What does top refer to? In my page, I have the following structure:

 

Home.html 

 

<frameset rows="175px, *" name="master"
xmlns:wicket="http://wicket.apache.org">

               <frame wicket:id="topFrame" name="top" />

               <frame wicket:id="bodyFrame" name="body"/>

</frameset>

 

Home.java

 

public class Home extends WebPage

{

               /** */

               private static final long serialVersionUID = 1L;

 

               /**

               * Constructor

               */

               public Home()

               {

            IRequestHandler topFrameHandler = new
BookmarkablePageRequestHandler(new PageProvider(

                    TopFrame.class));

            ExampleFrame topFrame = new ExampleFrame("topFrame",
topFrameHandler);

            add(topFrame);

 

               // TopFrame.class is all right, so I don't bother with it.

 

            IRequestHandler bodyFrameHandler = new
BookmarkablePageRequestHandler(new PageProvider(

                    BodyFrame.class));

            ExampleFrame bodyFrame = new ExampleFrame("bodyFrame",
bodyFrameHandler);

            add(bodyFrame);

               }

               // BodyFrame.class contains the left and right frames I am
concerned about.

}

 

BodyFrame.java

 

public class BodyFrame extends WebPage

{

               /** */

               private static final long serialVersionUID = 1L;

 

               private final FrameTarget frameTarget = new
FrameTarget(IntroPage.class);

 

               /**

               * Constructor

               */

               public BodyFrame()

               {

                              // create a new page instance, passing this
'master page' as an argument

                              LeftFrame leftFrame = new LeftFrame(this);

 
getSession().getPageManager().touchPage(leftFrame);

                              // get the url to that page

                              IRequestHandler leftFrameHandler = new
RenderPageRequestHandler(new PageProvider(leftFrame));

                              // and create a simple component that modifies
it's src attribute to

                              // hold the url to that frame

                              ExampleFrame leftFrameTag = new
ExampleFrame("leftFrame", leftFrameHandler);

                              add(leftFrameTag);

 

                              ExampleFrame rightFrameTag = new
ExampleFrame("rightFrame")

                              {

                                            /** */

                                            private static final long
serialVersionUID = 1L;

 

                                            protected CharSequence getUrl()

                                            {

                                                           return
frameTarget.getUrl();

                                            }

                              };

                              add(rightFrameTag);

               }

 

               /**

               * Gets frameTarget.

               * 

                * @return frameTarget

               */

               public FrameTarget getFrameTarget()

               {

                              return frameTarget;

               }

 

               /**

               * @see org.apache.wicket.Component#isVersioned()

               */

               @Override

               public boolean isVersioned()

               {

                              return false;

               }

}

 

BodyFrame.html

 

<frameset cols="350px, *" name="master"
xmlns:wicket="http://wicket.apache.org">

               <frame wicket:id="leftFrame" src="[set by index]" name="left"
/>

               <frame wicket:id="rightFrame" src="[set by index, modified by
left frame]" name="right" />

</frameset>

 

I tried the code you provided, but it did not work. Here is the JS code I
tried:

 

// pass selected skill value on to graph page

            ddSkills.add(new AjaxFormComponentUpdatingBehavior("onchange") {

                @Override

                protected void onUpdate(AjaxRequestTarget target) {

                    PageParameters pageParameters = new PageParameters();

                    pageParameters.add("skill", selectedSkill);

                    CharSequence pageURL = urlFor(TraineesView.class,
pageParameters);

                    

 
target.appendJavaScript("window.frames['body'].frames['right'].location=" 

                            + pageURL + ";");

                }

            });

 

Based on the code I provided, is this JS code supposed to work? I add this
code inside LeftFrame.java/.html, and I want to reference the html of
BodyFrame.

 

Thanks again,

 

Jeremie

 

From: Jesse Long-2 [via Apache Wicket]
[mailto:ml-node+s1842946n4660765h97@n4.nabble.com] 
Sent: August 7, 2013 07:30
To: Jeremie
Subject: Re: Wicket: DropDownChoice onChange open response page in right
frame

 

Hi Jeremie, 

You can use javascript: 

target.appendJavascript("top.frames['myframename'].location='" + 
urlFor(TraineeView.class,pageParamaters) + "';"); 

Cheers, 
Jesse 

On 07/08/2013 13:09, Jeremie wrote: 


> Hello, 
> 
> In my research project, I need to create a combo box with a list of
choices. 
> I use AJAX and DropDownChoice to perform some action on selection change.
My 
> application is based on the frames example on Wicket's website: 
> http://www.wicket-library.com/wicket-examples/frames/
> 
> When the user selects a choice in the combo box, I use PageParameters to 
> pass in the value of the selected choice to another Java/Wicket class I 
> created that will query values from a db based on the selected value and 
> will create a Highcharts graph in the right frame (the main frame). 
> 
> At this point, when I change the combo box selection, the graph opens, but

> in the left frame (or left menu bar if you prefer) instead of the main
body 
> (right frame). With anchor tags, I can specify the HTML target attribute 
> with the value "right" ( </a> <#> ) and this ensures my response page
opens 
> in the right frame, but my dropdown choices are not links. 
> 
> Here is my code that calls the response page with the parameters (ddSkills

> is a DropDownChoice object): 
> 
> // pass selected skill value on to graph page 
>              ddSkills.add(new
AjaxFormComponentUpdatingBehavior("onchange") { 
>                  @Override 
>                  protected void onUpdate(AjaxRequestTarget target) { 
>                      PageParameters pageParameters = new PageParameters();

>                      pageParameters.add("skill", selectedSkill); 
>                      setResponsePage(TraineesView.class, pageParameters); 
>                  } 
>              }); 
> 
> My questions is: how can I tell Wicket I want the response page to open in
a 
> new tab, or in my case the right frame, using PageParameters, or any other

> way I might not have figured out? Is is feasible using the values of a
combo 
> box or should I try using RepeatingView or ListView to make my "options" 
> links, in which case I could perhaps add the target attribute. 
> 
> Thanks for your help, 
> 
> Jeremie 
> 
> 
> 
> 
> -- 
> View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Wicket-DropDownChoice-onChange-op
en-response-page-in-right-frame-tp4660763.html
> Sent from the Users forum mailing list archive at Nabble.com. 
> 
> --------------------------------------------------------------------- 
> To unsubscribe, e-mail: [hidden email] 
> For additional commands, e-mail: [hidden email] 
> 
> 



--------------------------------------------------------------------- 
To unsubscribe, e-mail: [hidden email] 
For additional commands, e-mail: [hidden email] 




  _____  

If you reply to this email, your message will be added to the discussion
below:

http://apache-wicket.1842946.n4.nabble.com/Wicket-DropDownChoice-onChange-op
en-response-page-in-right-frame-tp4660763p4660765.html 

To unsubscribe from Wicket: DropDownChoice onChange open response page in
right frame, click here
<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=u
nsubscribe_by_code&node=4660763&code=anM3Nzc3QG91dGxvb2suY29tfDQ2NjA3NjN8LTE
5MzEyNTQ3NjU=> .
 
<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=m
acro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespace
s.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.te
mplate.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-in
stant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
NAML 





--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-DropDownChoice-onChange-open-response-page-in-right-frame-tp4660763p4660769.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Wicket: DropDownChoice onChange open response page in right frame

Posted by Jesse Long <jp...@unknown.za.net>.
Hi Jeremie,

You can use javascript:

target.appendJavascript("top.frames['myframename'].location='" + 
urlFor(TraineeView.class,pageParamaters) + "';");

Cheers,
Jesse

On 07/08/2013 13:09, Jeremie wrote:
> Hello,
>
> In my research project, I need to create a combo box with a list of choices.
> I use AJAX and DropDownChoice to perform some action on selection change. My
> application is based on the frames example on Wicket's website:
> http://www.wicket-library.com/wicket-examples/frames/
>
> When the user selects a choice in the combo box, I use PageParameters to
> pass in the value of the selected choice to another Java/Wicket class I
> created that will query values from a db based on the selected value and
> will create a Highcharts graph in the right frame (the main frame).
>
> At this point, when I change the combo box selection, the graph opens, but
> in the left frame (or left menu bar if you prefer) instead of the main body
> (right frame). With anchor tags, I can specify the HTML target attribute
> with the value "right" ( </a> <#> ) and this ensures my response page opens
> in the right frame, but my dropdown choices are not links.
>
> Here is my code that calls the response page with the parameters (ddSkills
> is a DropDownChoice object):
>
> 	// pass selected skill value on to graph page
>              ddSkills.add(new AjaxFormComponentUpdatingBehavior("onchange") {
>                  @Override
>                  protected void onUpdate(AjaxRequestTarget target) {
>                      PageParameters pageParameters = new PageParameters();
>                      pageParameters.add("skill", selectedSkill);
>                      setResponsePage(TraineesView.class, pageParameters);
>                  }
>              });
>
> My questions is: how can I tell Wicket I want the response page to open in a
> new tab, or in my case the right frame, using PageParameters, or any other
> way I might not have figured out? Is is feasible using the values of a combo
> box or should I try using RepeatingView or ListView to make my "options"
> links, in which case I could perhaps add the target attribute.
>
> Thanks for your help,
>
> Jeremie
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-DropDownChoice-onChange-open-response-page-in-right-frame-tp4660763.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


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


RE: Wicket: DropDownChoice onChange open response page in right frame

Posted by Jeremie <js...@outlook.com>.
Thanks both for your quick replies.

 

What does top refer to? In my page, I have the following structure:

 

Home.html 

 

<frameset rows="175px, *" name="master"
xmlns:wicket="http://wicket.apache.org">

               <frame wicket:id="topFrame" name="top" />

               <frame wicket:id="bodyFrame" name="body"/>

</frameset>

 

Home.java

 

public class Home extends WebPage

{

               /** */

               private static final long serialVersionUID = 1L;

 

               /**

               * Constructor

               */

               public Home()

               {

            IRequestHandler topFrameHandler = new
BookmarkablePageRequestHandler(new PageProvider(

                    TopFrame.class));

            ExampleFrame topFrame = new ExampleFrame("topFrame",
topFrameHandler);

            add(topFrame);

 

               // TopFrame.class is all right, so I don't bother with it.

 

            IRequestHandler bodyFrameHandler = new
BookmarkablePageRequestHandler(new PageProvider(

                    BodyFrame.class));

            ExampleFrame bodyFrame = new ExampleFrame("bodyFrame",
bodyFrameHandler);

            add(bodyFrame);

               }

               // BodyFrame.class contains the left and right frames I am
concerned about.

}

 

BodyFrame.java

 

public class BodyFrame extends WebPage

{

               /** */

               private static final long serialVersionUID = 1L;

 

               private final FrameTarget frameTarget = new
FrameTarget(IntroPage.class);

 

               /**

               * Constructor

               */

               public BodyFrame()

               {

                              // create a new page instance, passing this
'master page' as an argument

                              LeftFrame leftFrame = new LeftFrame(this);

 
getSession().getPageManager().touchPage(leftFrame);

                              // get the url to that page

                              IRequestHandler leftFrameHandler = new
RenderPageRequestHandler(new PageProvider(leftFrame));

                              // and create a simple component that modifies
it's src attribute to

                              // hold the url to that frame

                              ExampleFrame leftFrameTag = new
ExampleFrame("leftFrame", leftFrameHandler);

                              add(leftFrameTag);

 

                              ExampleFrame rightFrameTag = new
ExampleFrame("rightFrame")

                              {

                                            /** */

                                            private static final long
serialVersionUID = 1L;

 

                                            protected CharSequence getUrl()

                                            {

                                                           return
frameTarget.getUrl();

                                            }

                              };

                              add(rightFrameTag);

               }

 

               /**

               * Gets frameTarget.

               * 

                * @return frameTarget

               */

               public FrameTarget getFrameTarget()

               {

                              return frameTarget;

               }

 

               /**

               * @see org.apache.wicket.Component#isVersioned()

               */

               @Override

               public boolean isVersioned()

               {

                              return false;

               }

}

 

BodyFrame.html

 

<frameset cols="350px, *" name="master"
xmlns:wicket="http://wicket.apache.org">

               <frame wicket:id="leftFrame" src="[set by index]" name="left"
/>

               <frame wicket:id="rightFrame" src="[set by index, modified by
left frame]" name="right" />

</frameset>

 

I tried the code you provided, but it did not work. Here is the JS code I
tried:

 

// pass selected skill value on to graph page

            ddSkills.add(new AjaxFormComponentUpdatingBehavior("onchange") {

                @Override

                protected void onUpdate(AjaxRequestTarget target) {

                    PageParameters pageParameters = new PageParameters();

                    pageParameters.add("skill", selectedSkill);

                    CharSequence pageURL = urlFor(TraineesView.class,
pageParameters);

                    

 
target.appendJavaScript("window.frames['body'].frames['right'].location=" 

                            + pageURL + ";");

                }

            });

 

Based on the code I provided, is this JS code supposed to work? I add this
code inside LeftFrame.java/.html, and I want to reference the html of
BodyFrame.

 

Thanks again,

 

Jeremie

 

From: Jesse Long-2 [via Apache Wicket]
[mailto:ml-node+s1842946n4660765h97@n4.nabble.com] 
Sent: August 7, 2013 07:30
To: Jeremie
Subject: Re: Wicket: DropDownChoice onChange open response page in right
frame

 

Hi Jeremie, 

You can use javascript: 

target.appendJavascript("top.frames['myframename'].location='" + 
urlFor(TraineeView.class,pageParamaters) + "';"); 

Cheers, 
Jesse 

On 07/08/2013 13:09, Jeremie wrote: 


> Hello, 
> 
> In my research project, I need to create a combo box with a list of
choices. 
> I use AJAX and DropDownChoice to perform some action on selection change.
My 
> application is based on the frames example on Wicket's website: 
> http://www.wicket-library.com/wicket-examples/frames/
> 
> When the user selects a choice in the combo box, I use PageParameters to 
> pass in the value of the selected choice to another Java/Wicket class I 
> created that will query values from a db based on the selected value and 
> will create a Highcharts graph in the right frame (the main frame). 
> 
> At this point, when I change the combo box selection, the graph opens, but

> in the left frame (or left menu bar if you prefer) instead of the main
body 
> (right frame). With anchor tags, I can specify the HTML target attribute 
> with the value "right" ( </a> <#> ) and this ensures my response page
opens 
> in the right frame, but my dropdown choices are not links. 
> 
> Here is my code that calls the response page with the parameters (ddSkills

> is a DropDownChoice object): 
> 
> // pass selected skill value on to graph page 
>              ddSkills.add(new
AjaxFormComponentUpdatingBehavior("onchange") { 
>                  @Override 
>                  protected void onUpdate(AjaxRequestTarget target) { 
>                      PageParameters pageParameters = new PageParameters();

>                      pageParameters.add("skill", selectedSkill); 
>                      setResponsePage(TraineesView.class, pageParameters); 
>                  } 
>              }); 
> 
> My questions is: how can I tell Wicket I want the response page to open in
a 
> new tab, or in my case the right frame, using PageParameters, or any other

> way I might not have figured out? Is is feasible using the values of a
combo 
> box or should I try using RepeatingView or ListView to make my "options" 
> links, in which case I could perhaps add the target attribute. 
> 
> Thanks for your help, 
> 
> Jeremie 
> 
> 
> 
> 
> -- 
> View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Wicket-DropDownChoice-onChange-op
en-response-page-in-right-frame-tp4660763.html
> Sent from the Users forum mailing list archive at Nabble.com. 
> 
> --------------------------------------------------------------------- 
> To unsubscribe, e-mail: [hidden email] 
> For additional commands, e-mail: [hidden email] 
> 
> 



--------------------------------------------------------------------- 
To unsubscribe, e-mail: [hidden email] 
For additional commands, e-mail: [hidden email] 




  _____  

If you reply to this email, your message will be added to the discussion
below:

http://apache-wicket.1842946.n4.nabble.com/Wicket-DropDownChoice-onChange-op
en-response-page-in-right-frame-tp4660763p4660765.html 

To unsubscribe from Wicket: DropDownChoice onChange open response page in
right frame, click here
<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=u
nsubscribe_by_code&node=4660763&code=anM3Nzc3QG91dGxvb2suY29tfDQ2NjA3NjN8LTE
5MzEyNTQ3NjU=> .
 
<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=m
acro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespace
s.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.te
mplate.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-in
stant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
NAML 





--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-DropDownChoice-onChange-open-response-page-in-right-frame-tp4660763p4660768.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Wicket: DropDownChoice onChange open response page in right frame

Posted by Martin Grigorov <mg...@apache.org>.
Hi,


On Wed, Aug 7, 2013 at 1:09 PM, Jeremie <js...@outlook.com> wrote:

> Hello,
>
> In my research project, I need to create a combo box with a list of
> choices.
> I use AJAX and DropDownChoice to perform some action on selection change.
> My
> application is based on the frames example on Wicket's website:
> http://www.wicket-library.com/wicket-examples/frames/
>
> When the user selects a choice in the combo box, I use PageParameters to
> pass in the value of the selected choice to another Java/Wicket class I
> created that will query values from a db based on the selected value and
> will create a Highcharts graph in the right frame (the main frame).
>
> At this point, when I change the combo box selection, the graph opens, but
> in the left frame (or left menu bar if you prefer) instead of the main body
> (right frame). With anchor tags, I can specify the HTML target attribute
> with the value "right" ( </a> <#> ) and this ensures my response page opens
> in the right frame, but my dropdown choices are not links.
>
> Here is my code that calls the response page with the parameters (ddSkills
> is a DropDownChoice object):
>
>         // pass selected skill value on to graph page
>             ddSkills.add(new AjaxFormComponentUpdatingBehavior("onchange")
> {
>                 @Override
>                 protected void onUpdate(AjaxRequestTarget target) {
>                     PageParameters pageParameters = new PageParameters();
>                     pageParameters.add("skill", selectedSkill);
>                     setResponsePage(TraineesView.class, pageParameters);
>

You can do this with some manually written JavaScript.
Something like:

CharSequence pageUrl = urlFor(TraineesView.class, pageParameters);
target.appendJavaScript("frameReload('"+pageUrl+"')");

where frameReload is something like:
function frameReload(url) {
 window.frames['right'].src = url;
}

I haven't used <frame> personally for maybe 8 years, so the above may be
not fully correct.

Why do you want to use <frameset> ?
Better use some CSS grid solution like http://getbootstrap.com/,
http://ink.sapo.pt/ or http://foundation.zurb.com/


>                 }
>             });
>
> My questions is: how can I tell Wicket I want the response page to open in
> a
> new tab, or in my case the right frame, using PageParameters, or any other
> way I might not have figured out? Is is feasible using the values of a
> combo
> box or should I try using RepeatingView or ListView to make my "options"
> links, in which case I could perhaps add the target attribute.
>
> Thanks for your help,
>
> Jeremie
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-DropDownChoice-onChange-open-response-page-in-right-frame-tp4660763.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>