You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by jason <ja...@gmail.com> on 2012/04/03 22:02:26 UTC

how to make a div containing ajax link clickable

Hi,

What is the best way to make a div clickable? I'd like to use an AjaxLink
such that whenever a user clicks within the outerdiv I can handle it within
the onClick method of AjaxLink

<div class="box">
   <img.../>
    <div class="subbox">
     some text....
    </div>
</div>

Thanks, Jason

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-make-a-div-containing-ajax-link-clickable-tp4530016p4530016.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 make a div containing ajax link clickable

Posted by jason <ja...@gmail.com>.
Sorry that last HTML snippet should be:

<div class="calendar-box" wicket:id="calendarBox">
                    <div class="calendar-date-label"></div>
                    <div class="calendar-day-label"></div>
</div>

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-make-a-div-containing-ajax-link-clickable-tp4530016p4530447.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 make a div containing ajax link clickable

Posted by jason <ja...@gmail.com>.
Argh Nabble keeps stripping my HTML.. but it should be

div class="calendar-box"
    div class="calendar-date-label" span wicket:id="monthYear" /span /div
    div class="calendar-day-label" span wicket:id="day" /span /div
/div

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-make-a-div-containing-ajax-link-clickable-tp4530016p4530505.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 make a div containing ajax link clickable

Posted by jason <ja...@gmail.com>.
Sorry that last HTML snippet should be:


                    

                    

                


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-make-a-div-containing-ajax-link-clickable-tp4530016p4530456.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 make a div containing ajax link clickable

Posted by Martin Grigorov <mg...@apache.org>.
On Wed, Apr 4, 2012 at 12:55 AM, jason <ja...@gmail.com> wrote:
> This is weird... If I do something like this taken from
> http://wicket.apache.org/apidocs/1.4/org/apache/wicket/ajax/AjaxEventBehavior.html
>
> WebMarkupContainer div=new WebMarkupContainer("div");
>         div.setOutputMarkupId(true);
>         div.add(new AjaxEventBehavior("onclick") {
>             protected void onEvent(AjaxRequestTarget target) {
>                 System.out.println("ajax here!");
>             }
>         }
>
> <div wicket:id="div>Click me</div>
>
> it works fine. However, if I do something like this:
>
> <div class="calendar-box" wicket:id="calendarBox">
>                    <div class="calendar-date-label"></div>
>                    <div class="calendar-day-label"></div>
>                </div>
>
> calendarBox.add(new AjaxEventBehavior("onclick") {
>                @Override
>                protected void onEvent(AjaxRequestTarget target) {
>                    System.out.println("ajax here!");
>                }
>            });
>            calendarBox.add(new Label("monthYear", monthYear.format(date)));
>            calendarBox.add(new Label("day", dayFormat.format(date)));
>
> Then I get
>
> java.lang.ClassNotFoundException: undefined
>        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

Paste the whole stacktrace.

>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-make-a-div-containing-ajax-link-clickable-tp4530016p4530444.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
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: how to make a div containing ajax link clickable

Posted by jason <ja...@gmail.com>.
This is weird... If I do something like this taken from
http://wicket.apache.org/apidocs/1.4/org/apache/wicket/ajax/AjaxEventBehavior.html

WebMarkupContainer div=new WebMarkupContainer("div");
         div.setOutputMarkupId(true);
         div.add(new AjaxEventBehavior("onclick") {
             protected void onEvent(AjaxRequestTarget target) {
                 System.out.println("ajax here!");
             }
         }

<div wicket:id="div>Click me</div>

it works fine. However, if I do something like this:

<div class="calendar-box" wicket:id="calendarBox">
                    <div class="calendar-date-label"></div>
                    <div class="calendar-day-label"></div>
                </div>

calendarBox.add(new AjaxEventBehavior("onclick") {
                @Override
                protected void onEvent(AjaxRequestTarget target) {                   
                    System.out.println("ajax here!");
                }
            });
            calendarBox.add(new Label("monthYear", monthYear.format(date)));
            calendarBox.add(new Label("day", dayFormat.format(date)));

Then I get 

java.lang.ClassNotFoundException: undefined
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-make-a-div-containing-ajax-link-clickable-tp4530016p4530444.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 make a div containing ajax link clickable

Posted by "Richard W. Adams" <RW...@UP.COM>.
add(new AjaxEventBehavior("onclick")

"RAM /abr./: Rarely Adequate Memory." 



From:   jason <ja...@gmail.com>
To:     users@wicket.apache.org
Date:   04/03/2012 03:02 PM
Subject:        how to make a div containing ajax link clickable



Hi,

What is the best way to make a div clickable? I'd like to use an AjaxLink
such that whenever a user clicks within the outerdiv I can handle it 
within
the onClick method of AjaxLink

<div class="box">
   <img.../>
    <div class="subbox">
     some text....
    </div>
</div>

Thanks, Jason

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-make-a-div-containing-ajax-link-clickable-tp4530016p4530016.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




**

This email and any attachments may contain information that is confidential and/or privileged for the sole use of the intended recipient.  Any use, review, disclosure, copying, distribution or reliance by others, and any forwarding of this email or its contents, without the express permission of the sender is strictly prohibited by law.  If you are not the intended recipient, please contact the sender immediately, delete the e-mail and destroy all copies.
**