You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Pratibha <pr...@gmail.com> on 2016/10/26 13:15:08 UTC

how to call modal window on link

Hi,

is it possible to call modal window on simple link without Ajax Request?
public void onClick() {
}

Thanks


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882.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: how to call modal window on link

Posted by Martin Grigorov <mg...@apache.org>.
Check for JavaScript errors.

"it's not working" doesn't tell us much to be able to help you

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Oct 31, 2016 at 3:11 PM, Pratibha <pr...@gmail.com>
wrote:

> I tried that its not working, not sure what i am missing.
>
> @Override
> public void onClick() {
> confirmModal.add(new OpenWindowOnLoadBehavior());
> }
>
> public class OpenWindowOnLoadBehavior extends AbstractDefaultAjaxBehavior {
>   @Override
>   protected void respond(AjaxRequestTarget target) {
>       ModalWindow window = (ModalWindow) getComponent();
>       window.show(target);
>   }
>   @Override
>   public void renderHead(final Component component, IHeaderResponse
> response) {
>         super.renderHead(component, response);
> response.render(OnEventHeaderItem.forScript("'" +
> component.getMarkupId()+
> "'","click", getCallbackScript()));
>   }
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675977.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: how to call modal window on link

Posted by Pratibha <pr...@gmail.com>.
I tried that its not working, not sure what i am missing.

@Override
public void onClick() {
confirmModal.add(new OpenWindowOnLoadBehavior());
}		
			
public class OpenWindowOnLoadBehavior extends AbstractDefaultAjaxBehavior {
  @Override
  protected void respond(AjaxRequestTarget target) {
      ModalWindow window = (ModalWindow) getComponent();
      window.show(target);
  }
  @Override
  public void renderHead(final Component component, IHeaderResponse
response) {
  	super.renderHead(component, response);
response.render(OnEventHeaderItem.forScript("'" +  component.getMarkupId()+
"'","click", getCallbackScript()));
  }
  

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675977.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: how to call modal window on link

Posted by Martin Grigorov <mg...@apache.org>.
click

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Oct 31, 2016 at 3:00 PM, Pratibha <pr...@gmail.com>
wrote:

> please advise which event i should use on link click then?
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675974.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: how to call modal window on link

Posted by Pratibha <pr...@gmail.com>.
please advise which event i should use on link click then?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675974.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: how to call modal window on link

Posted by Martin Grigorov <mg...@apache.org>.
"onclick" is not a valid JS event name

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Oct 31, 2016 at 2:51 PM, Pratibha <pr...@gmail.com>
wrote:

> Thank you i tried this,it does not seem to be doing anything i want to call
> modal window on link click. am i missing something?
>
> response.render(OnEventHeaderItem.forScript("'" +
> component.getMarkupId()+
> "'", "onclick", getCallbackScript()));
>
> Please advise.
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675972.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: how to call modal window on link

Posted by Pratibha <pr...@gmail.com>.
Thank you i tried this,it does not seem to be doing anything i want to call
modal window on link click. am i missing something?

response.render(OnEventHeaderItem.forScript("'" +  component.getMarkupId()+
"'", "onclick", getCallbackScript()));

Please advise.



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675972.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: how to call modal window on link

Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Oct 31, 2016 at 2:35 PM, Pratibha <pr...@gmail.com>
wrote:

> That seems to be working  ok but when i close modalwindow it again Loads
> page
>
> is it possible to use
> response.render(OnEventHeaderItem.forScript(getCallbackScript().toString()
> ));
>

OnLoadHeaderItem just does: window.onload
So yes, you could use OnEventHeaderItem.forScript() with any better event.


>
> instead of OnloadHeaderItem
>
> Thank you
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675966.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: how to call modal window on link

Posted by Pratibha <pr...@gmail.com>.
That seems to be working  ok but when i close modalwindow it again Loads page

is it possible to use
response.render(OnEventHeaderItem.forScript(getCallbackScript().toString())); 

instead of OnloadHeaderItem

Thank you

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675966.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: how to call modal window on link

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
checked that you don't target="_blank" on that link.

On Thu, Oct 27, 2016 at 2:40 PM, Pratibha <pr...@gmail.com>
wrote:

> Thank you that seems to be working but when i click on link it  first opens
> the same page in new tab and after that i can see modalWindow.
>
> So basically i end up with 2 same pages in 2 tabs one with modalwindow.
>
> confirmModal.add(new OpenWindowOnLoadBehavior());
> confirmModal.setContent(new
> ComplaintModal(confirmModal.getContentId(),confirmModal,_form));
>
> I need modalwindow to be opened in same page on button click.
>
> Thank you so much...
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675913.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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro

Re: how to call modal window on link

Posted by Pratibha <pr...@gmail.com>.
Thank you that seems to be working but when i click on link it  first opens
the same page in new tab and after that i can see modalWindow.

So basically i end up with 2 same pages in 2 tabs one with modalwindow.

confirmModal.add(new OpenWindowOnLoadBehavior());
confirmModal.setContent(new
ComplaintModal(confirmModal.getContentId(),confirmModal,_form));

I need modalwindow to be opened in same page on button click.

Thank you so much...


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675913.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: how to call modal window on link

Posted by Martin Grigorov <mg...@apache.org>.
response.render(OnLoadHeaderItem.forScript(getCallbackScript().toString());

Should be something like this.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Oct 27, 2016 at 2:08 PM, Pratibha <pr...@gmail.com>
wrote:

> I am trying to call modal window but this is not working my code is
>
> @Override
>                         public void onClick() {
>
>                                 confirmModal.add(new
> OpenWindowOnLoadBehavior());
>                               confirmModal.setPageCreator(new
> ModalWindow.PageCreator() {
>                     @Override
>                     public Page createPage() {
>                         return new RedirectPage("http://www.google.com");
>                     }
>                 });
>                                 }
>
> public class OpenWindowOnLoadBehavior extends AbstractDefaultAjaxBehavior {
>   @Override
>   protected void respond(AjaxRequestTarget target) {
>       ModalWindow window = (ModalWindow) getComponent();
>       window.show(target);
>   }
>   @Override
>   public void renderHead(final Component component, IHeaderResponse
> response) {
>
>       *response.renderOnLoadJavascript(getCallbackScript().toString());*
>   }
>
> Please help me with this.
>
> Thanks
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675907.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: how to call modal window on link

Posted by Pratibha <pr...@gmail.com>.
I am trying to call modal window but this is not working my code is

@Override
			public void onClick() {

				confirmModal.add(new OpenWindowOnLoadBehavior());
			      confirmModal.setPageCreator(new ModalWindow.PageCreator() {
	            @Override
	            public Page createPage() {
	                return new RedirectPage("http://www.google.com");
	            }
	        });
				}

public class OpenWindowOnLoadBehavior extends AbstractDefaultAjaxBehavior {
  @Override
  protected void respond(AjaxRequestTarget target) {
      ModalWindow window = (ModalWindow) getComponent();
      window.show(target);
  }
  @Override
  public void renderHead(final Component component, IHeaderResponse
response) {
  
      *response.renderOnLoadJavascript(getCallbackScript().toString());*
  }

Please help me with this.

Thanks
	


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675907.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: how to call modal window on link

Posted by Pratibha <pr...@gmail.com>.
Compile error..The method renderOnLoadJavascript(String) is undefined for the
type IHeaderResponse

public class OpenWindowOnLoadBehavior extends AbstractDefaultAjaxBehavior {
  @Override
  protected void respond(AjaxRequestTarget target) {
      ModalWindow window = (ModalWindow) getComponent();
      window.show(target);
  }
  @Override
  public void renderHead(final Component component, IHeaderResponse
response) {
       
      //*response.renderOnLoadJavascript(getCallbackScript().toString());*
  }
	
}

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675906.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: how to call modal window on link

Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Oct 27, 2016 at 1:41 PM, Pratibha <pr...@gmail.com>
wrote:

> Hi thank you for your help  but the below lines in OpenWindowOnLoadBehavior
> seems to be creating issue
>

What kind of issue ?


>
>   @Override
>     public void renderHead(IHeaderResponse response) {
>         response.renderOnLoadJavascript(getCallbackScript().toString());
>     }
>
> I followed code in
> http://stackoverflow.com/questions/4765790/how-to-open-
> modaldialog-on-pageload.
>
> I cant get it working :(. Please advise.
>
> Thank you.
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675903.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: how to call modal window on link

Posted by Pratibha <pr...@gmail.com>.
Hi thank you for your help  but the below lines in OpenWindowOnLoadBehavior 
seems to be creating issue

  @Override
    public void renderHead(IHeaderResponse response) {
        response.renderOnLoadJavascript(getCallbackScript().toString());
    }

I followed code in
http://stackoverflow.com/questions/4765790/how-to-open-modaldialog-on-pageload.

I cant get it working :(. Please advise.

Thank you.



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675903.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: how to call modal window on link

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
http://stackoverflow.com/questions/4765790/how-to-open-modaldialog-on-pageload

and

https://cwiki.apache.org/confluence/display/WICKET/Modal+Windows

Hope it still works as it did a few years ago!


On Wed, Oct 26, 2016 at 3:15 PM, Pratibha <pr...@gmail.com>
wrote:

> Hi,
>
> is it possible to call modal window on simple link without Ajax Request?
> public void onClick() {
> }
>
> Thanks
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/how-to-call-modal-window-on-link-tp4675882.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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro