You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adam Ruggles <a....@gmail.com> on 2007/02/27 02:27:38 UTC

[S2] Ajax Div bind function not working.

I'm currently in the process of migrating my webwork 2 application over 
to struts 2.  I only have one more remaining issue the function 
specified on this page doesn't seem to work 
(http://struts.apache.org/2.x/docs/ajax-div-template.html).

function refresh(elementId, href) {
  var elementDiv = window[elementId];
  elementDiv.href = href;
  elementDiv.bind();
}


Generated html on the page:

<div dojotype="struts:BindDiv" id="results" href="/finance/search/account.action?query=accounts" showerror="true">
   ...
   <a class="number" href="javascript:;" onclick="refresh('results','/finance/search/account.action?query=accounts&offset=10');">2</a>
   ...
</div>

Error: elementDiv has no properties.

This worked previously in webwork.  I've updated the tag library and all 
the other tags work and I have <s:head theme="ajax"/> in the head 
section of the jsp page.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] Ajax Div bind function not working.

Posted by Adam Ruggles <a....@gmail.com>.
The dojo.widget.byId and .refresh() did it.  Thanks for you help.

Musachy Barroso wrote:
> I think that's related to Dojo instead of struts, if you do:
>
> windows[id]
>
> it is going to return the element object for the div(as it should), which
> doesn't have an "href". If you do:
>
> dojo.widget.byId(id)
>
> it will return the widget for the div.
>
> musachy
>
> On 2/26/07, Adam Ruggles <a....@gmail.com> wrote:
>>
>> The error I'm getting is "Error: elementDiv has no properties." in
>> Firefox.  Basically Window[elementId] is returning undefined.  This
>> worked fine when I was using Webwork.  The only changes I made was to
>> move everything to struts 2.  All my other pages and tags are working
>> fine, the only issue I have left is this BindDiv refresh issue.
>>
>> Musachy Barroso wrote:
>> > "href" is a valid property on the BindDiv widget, what kind of error
>> > are you
>> > getting? (
>> >
>> http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js?view=markup 
>>
>> >
>> > )
>> >
>> > ajax docs: http://cwiki.apache.org/WW/ajax-tags.html
>> >
>> > Showcase has several examples also.
>> >
>> > regards
>> > musachy
>> >
>> > On 2/26/07, Adam Ruggles <a....@gmail.com> wrote:
>> >>
>> >> Well the part it is dying on is the "elementDiv.href = href;" so it
>> >> isn't even getting to the bind.  Also is there a doc on how to use
>> >> refreshListentTopics, I don't know if I understand how to use it 
>> with a
>> >> link?
>> >>
>> >> Musachy Barroso wrote:
>> >> > You can use "refresh" instead. Or "refreshListentTopics" if you wan
>> to
>> >> > use
>> >> > topics. "bind" should have been there for backward compatibility 
>> (mea
>> >> > culpa)
>> >> >
>> >> > regards
>> >> > musachy
>> >> >
>> >> > On 2/26/07, Adam Ruggles <a....@gmail.com> wrote:
>> >> >>
>> >> >> I'm currently in the process of migrating my webwork 2 application
>> >> over
>> >> >> to struts 2.  I only have one more remaining issue the function
>> >> >> specified on this page doesn't seem to work
>> >> >> (http://struts.apache.org/2.x/docs/ajax-div-template.html).
>> >> >>
>> >> >> function refresh(elementId, href) {
>> >> >>   var elementDiv = window[elementId];
>> >> >>   elementDiv.href = href;
>> >> >>   elementDiv.bind();
>> >> >> }
>> >> >>
>> >> >>
>> >> >> Generated html on the page:
>> >> >>
>> >> >> <div dojotype="struts:BindDiv" id="results"
>> >> >> href="/finance/search/account.action?query=accounts"
>> >> showerror="true">
>> >> >>    ...
>> >> >>    <a class="number" href="javascript:;"
>> >> >>
>> >>
>> onclick="refresh('results','/finance/search/account.action?query=accounts&offset=10');">2</a> 
>>
>> >>
>> >> >>
>> >> >>    ...
>> >> >> </div>
>> >> >>
>> >> >> Error: elementDiv has no properties.
>> >> >>
>> >> >> This worked previously in webwork.  I've updated the tag 
>> library and
>> >> all
>> >> >> the other tags work and I have <s:head theme="ajax"/> in the head
>> >> >> section of the jsp page.
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >> >> For additional commands, e-mail: user-help@struts.apache.org
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >> For additional commands, e-mail: user-help@struts.apache.org
>> >>
>> >>
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] Ajax Div bind function not working.

Posted by Musachy Barroso <mu...@gmail.com>.
I think that's related to Dojo instead of struts, if you do:

windows[id]

it is going to return the element object for the div(as it should), which
doesn't have an "href". If you do:

dojo.widget.byId(id)

it will return the widget for the div.

musachy

On 2/26/07, Adam Ruggles <a....@gmail.com> wrote:
>
> The error I'm getting is "Error: elementDiv has no properties." in
> Firefox.  Basically Window[elementId] is returning undefined.  This
> worked fine when I was using Webwork.  The only changes I made was to
> move everything to struts 2.  All my other pages and tags are working
> fine, the only issue I have left is this BindDiv refresh issue.
>
> Musachy Barroso wrote:
> > "href" is a valid property on the BindDiv widget, what kind of error
> > are you
> > getting? (
> >
> http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js?view=markup
> >
> > )
> >
> > ajax docs: http://cwiki.apache.org/WW/ajax-tags.html
> >
> > Showcase has several examples also.
> >
> > regards
> > musachy
> >
> > On 2/26/07, Adam Ruggles <a....@gmail.com> wrote:
> >>
> >> Well the part it is dying on is the "elementDiv.href = href;" so it
> >> isn't even getting to the bind.  Also is there a doc on how to use
> >> refreshListentTopics, I don't know if I understand how to use it with a
> >> link?
> >>
> >> Musachy Barroso wrote:
> >> > You can use "refresh" instead. Or "refreshListentTopics" if you wan
> to
> >> > use
> >> > topics. "bind" should have been there for backward compatibility (mea
> >> > culpa)
> >> >
> >> > regards
> >> > musachy
> >> >
> >> > On 2/26/07, Adam Ruggles <a....@gmail.com> wrote:
> >> >>
> >> >> I'm currently in the process of migrating my webwork 2 application
> >> over
> >> >> to struts 2.  I only have one more remaining issue the function
> >> >> specified on this page doesn't seem to work
> >> >> (http://struts.apache.org/2.x/docs/ajax-div-template.html).
> >> >>
> >> >> function refresh(elementId, href) {
> >> >>   var elementDiv = window[elementId];
> >> >>   elementDiv.href = href;
> >> >>   elementDiv.bind();
> >> >> }
> >> >>
> >> >>
> >> >> Generated html on the page:
> >> >>
> >> >> <div dojotype="struts:BindDiv" id="results"
> >> >> href="/finance/search/account.action?query=accounts"
> >> showerror="true">
> >> >>    ...
> >> >>    <a class="number" href="javascript:;"
> >> >>
> >>
> onclick="refresh('results','/finance/search/account.action?query=accounts&offset=10');">2</a>
> >>
> >> >>
> >> >>    ...
> >> >> </div>
> >> >>
> >> >> Error: elementDiv has no properties.
> >> >>
> >> >> This worked previously in webwork.  I've updated the tag library and
> >> all
> >> >> the other tags work and I have <s:head theme="ajax"/> in the head
> >> >> section of the jsp page.
> >> >>
> >> >>
> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> >> For additional commands, e-mail: user-help@struts.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

Re: [S2] Ajax Div bind function not working.

Posted by Adam Ruggles <a....@gmail.com>.
The error I'm getting is "Error: elementDiv has no properties." in 
Firefox.  Basically Window[elementId] is returning undefined.  This 
worked fine when I was using Webwork.  The only changes I made was to 
move everything to struts 2.  All my other pages and tags are working 
fine, the only issue I have left is this BindDiv refresh issue.

Musachy Barroso wrote:
> "href" is a valid property on the BindDiv widget, what kind of error 
> are you
> getting? (
> http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js?view=markup 
>
> )
>
> ajax docs: http://cwiki.apache.org/WW/ajax-tags.html
>
> Showcase has several examples also.
>
> regards
> musachy
>
> On 2/26/07, Adam Ruggles <a....@gmail.com> wrote:
>>
>> Well the part it is dying on is the "elementDiv.href = href;" so it
>> isn't even getting to the bind.  Also is there a doc on how to use
>> refreshListentTopics, I don't know if I understand how to use it with a
>> link?
>>
>> Musachy Barroso wrote:
>> > You can use "refresh" instead. Or "refreshListentTopics" if you wan to
>> > use
>> > topics. "bind" should have been there for backward compatibility (mea
>> > culpa)
>> >
>> > regards
>> > musachy
>> >
>> > On 2/26/07, Adam Ruggles <a....@gmail.com> wrote:
>> >>
>> >> I'm currently in the process of migrating my webwork 2 application 
>> over
>> >> to struts 2.  I only have one more remaining issue the function
>> >> specified on this page doesn't seem to work
>> >> (http://struts.apache.org/2.x/docs/ajax-div-template.html).
>> >>
>> >> function refresh(elementId, href) {
>> >>   var elementDiv = window[elementId];
>> >>   elementDiv.href = href;
>> >>   elementDiv.bind();
>> >> }
>> >>
>> >>
>> >> Generated html on the page:
>> >>
>> >> <div dojotype="struts:BindDiv" id="results"
>> >> href="/finance/search/account.action?query=accounts" 
>> showerror="true">
>> >>    ...
>> >>    <a class="number" href="javascript:;"
>> >>
>> onclick="refresh('results','/finance/search/account.action?query=accounts&offset=10');">2</a> 
>>
>> >>
>> >>    ...
>> >> </div>
>> >>
>> >> Error: elementDiv has no properties.
>> >>
>> >> This worked previously in webwork.  I've updated the tag library and
>> all
>> >> the other tags work and I have <s:head theme="ajax"/> in the head
>> >> section of the jsp page.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >> For additional commands, e-mail: user-help@struts.apache.org
>> >>
>> >>
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] Ajax Div bind function not working.

Posted by Musachy Barroso <mu...@gmail.com>.
"href" is a valid property on the BindDiv widget, what kind of error are you
getting? (
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js?view=markup
)

ajax docs: http://cwiki.apache.org/WW/ajax-tags.html

Showcase has several examples also.

regards
musachy

On 2/26/07, Adam Ruggles <a....@gmail.com> wrote:
>
> Well the part it is dying on is the "elementDiv.href = href;" so it
> isn't even getting to the bind.  Also is there a doc on how to use
> refreshListentTopics, I don't know if I understand how to use it with a
> link?
>
> Musachy Barroso wrote:
> > You can use "refresh" instead. Or "refreshListentTopics" if you wan to
> > use
> > topics. "bind" should have been there for backward compatibility (mea
> > culpa)
> >
> > regards
> > musachy
> >
> > On 2/26/07, Adam Ruggles <a....@gmail.com> wrote:
> >>
> >> I'm currently in the process of migrating my webwork 2 application over
> >> to struts 2.  I only have one more remaining issue the function
> >> specified on this page doesn't seem to work
> >> (http://struts.apache.org/2.x/docs/ajax-div-template.html).
> >>
> >> function refresh(elementId, href) {
> >>   var elementDiv = window[elementId];
> >>   elementDiv.href = href;
> >>   elementDiv.bind();
> >> }
> >>
> >>
> >> Generated html on the page:
> >>
> >> <div dojotype="struts:BindDiv" id="results"
> >> href="/finance/search/account.action?query=accounts" showerror="true">
> >>    ...
> >>    <a class="number" href="javascript:;"
> >>
> onclick="refresh('results','/finance/search/account.action?query=accounts&offset=10');">2</a>
> >>
> >>    ...
> >> </div>
> >>
> >> Error: elementDiv has no properties.
> >>
> >> This worked previously in webwork.  I've updated the tag library and
> all
> >> the other tags work and I have <s:head theme="ajax"/> in the head
> >> section of the jsp page.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

Re: [S2] Ajax Div bind function not working.

Posted by Adam Ruggles <a....@gmail.com>.
Well the part it is dying on is the "elementDiv.href = href;" so it 
isn't even getting to the bind.  Also is there a doc on how to use 
refreshListentTopics, I don't know if I understand how to use it with a 
link?

Musachy Barroso wrote:
> You can use "refresh" instead. Or "refreshListentTopics" if you wan to 
> use
> topics. "bind" should have been there for backward compatibility (mea 
> culpa)
>
> regards
> musachy
>
> On 2/26/07, Adam Ruggles <a....@gmail.com> wrote:
>>
>> I'm currently in the process of migrating my webwork 2 application over
>> to struts 2.  I only have one more remaining issue the function
>> specified on this page doesn't seem to work
>> (http://struts.apache.org/2.x/docs/ajax-div-template.html).
>>
>> function refresh(elementId, href) {
>>   var elementDiv = window[elementId];
>>   elementDiv.href = href;
>>   elementDiv.bind();
>> }
>>
>>
>> Generated html on the page:
>>
>> <div dojotype="struts:BindDiv" id="results"
>> href="/finance/search/account.action?query=accounts" showerror="true">
>>    ...
>>    <a class="number" href="javascript:;"
>> onclick="refresh('results','/finance/search/account.action?query=accounts&offset=10');">2</a> 
>>
>>    ...
>> </div>
>>
>> Error: elementDiv has no properties.
>>
>> This worked previously in webwork.  I've updated the tag library and all
>> the other tags work and I have <s:head theme="ajax"/> in the head
>> section of the jsp page.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] Ajax Div bind function not working.

Posted by Musachy Barroso <mu...@gmail.com>.
You can use "refresh" instead. Or "refreshListentTopics" if you wan to use
topics. "bind" should have been there for backward compatibility (mea culpa)

regards
musachy

On 2/26/07, Adam Ruggles <a....@gmail.com> wrote:
>
> I'm currently in the process of migrating my webwork 2 application over
> to struts 2.  I only have one more remaining issue the function
> specified on this page doesn't seem to work
> (http://struts.apache.org/2.x/docs/ajax-div-template.html).
>
> function refresh(elementId, href) {
>   var elementDiv = window[elementId];
>   elementDiv.href = href;
>   elementDiv.bind();
> }
>
>
> Generated html on the page:
>
> <div dojotype="struts:BindDiv" id="results"
> href="/finance/search/account.action?query=accounts" showerror="true">
>    ...
>    <a class="number" href="javascript:;"
> onclick="refresh('results','/finance/search/account.action?query=accounts&offset=10');">2</a>
>    ...
> </div>
>
> Error: elementDiv has no properties.
>
> This worked previously in webwork.  I've updated the tag library and all
> the other tags work and I have <s:head theme="ajax"/> in the head
> section of the jsp page.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd