You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Célio Cidral Junior <cc...@gmail.com> on 2007/01/02 18:17:02 UTC

preInvokeJS does not work for tag

Hi,

The preInvokeJS attribute does not work for the <a> tag as described
in the example from <http://struts.apache.org/2.x/docs/a.html>. That
feature seems to be originated from the issue
<http://issues.apache.org/struts/browse/WW-912>. Below is a snippet of
my source JSP code.

<s:a href="%{delete}" preInvokeJS="confirm('%{getText('confirm-delete')}')">
	<s:text name="record.delete"/>
</s:a>

The anchor works properly, except that it does not call the confirm()
method. The generated HTML gives me this code:

<a href="/sed/listUsers!delete.do?id=1">Deletar</a>

And there's no occurrence of the word "confirm" in the whole HTML code
nor there's any reference to an external JS file.

I presume I'm not missing anything. Any guess whether this feature is
actually working or not?

Célio.

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


Re: preInvokeJS does not work for tag

Posted by Musachy Barroso <mb...@wfscorp.com>.
Hi Celio

"preInvokeJS" will only work while using the ajax theme, if you are not 
using it, then the regular "onclick" attribute will do.

regards
musachy

The

Célio Cidral Junior wrote:
> Hi Musachy,
>
> 2007/1/2, Musachy Barroso <mb...@wfscorp.com>:
>> What version are you using? using head svn , I modified showcase's
>> remote link first example to this:
>>
>> <s:a
>>         theme="ajax"
>>         href="%{ajaxTest}"
>>         indicator="indicator"
>>         targets="t1,t2" notifyTopics="/after"
>> preInvokeJS="alert('test')">Update 'Div 1' and 'Div 2', publish topic
>> '/after', use indicator</s:a>
>>
>> and it shows "test". "preInvokeJS" is deprecated. If you are using head
>> svn, use "notifyTopics" instead. See showcase for examples, or this 
>> link:
>>
>> http://struts.apache.org/2.x/docs/ajax-tags.html
>
> I don't know much about ajax (well, almost nothing), but using the
> ajax theme in my case is not a kludge?
>
> Regards,
>
> Célio.
>
> ---------------------------------------------------------------------
> 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: preInvokeJS does not work for tag

Posted by Célio Cidral Junior <cc...@gmail.com>.
Hi Musachy,

2007/1/2, Musachy Barroso <mb...@wfscorp.com>:
> What version are you using? using head svn , I modified showcase's
> remote link first example to this:
>
> <s:a
>         theme="ajax"
>         href="%{ajaxTest}"
>         indicator="indicator"
>         targets="t1,t2" notifyTopics="/after"
> preInvokeJS="alert('test')">Update 'Div 1' and 'Div 2', publish topic
> '/after', use indicator</s:a>
>
> and it shows "test". "preInvokeJS" is deprecated. If you are using head
> svn, use "notifyTopics" instead. See showcase for examples, or this link:
>
> http://struts.apache.org/2.x/docs/ajax-tags.html

I don't know much about ajax (well, almost nothing), but using the
ajax theme in my case is not a kludge?

Regards,

Célio.

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


Re: preInvokeJS does not work for tag

Posted by Musachy Barroso <mb...@wfscorp.com>.
What version are you using? using head svn , I modified showcase's 
remote link first example to this:

<s:a
        theme="ajax"
        href="%{ajaxTest}"
        indicator="indicator"
        targets="t1,t2" notifyTopics="/after" 
preInvokeJS="alert('test')">Update 'Div 1' and 'Div 2', publish topic 
'/after', use indicator</s:a>

and it shows "test". "preInvokeJS" is deprecated. If you are using head 
svn, use "notifyTopics" instead. See showcase for examples, or this link:

http://struts.apache.org/2.x/docs/ajax-tags.html

regards
musachy



Célio Cidral Junior wrote:
> Hi,
>
> The preInvokeJS attribute does not work for the <a> tag as described
> in the example from <http://struts.apache.org/2.x/docs/a.html>. That
> feature seems to be originated from the issue
> <http://issues.apache.org/struts/browse/WW-912>. Below is a snippet of
> my source JSP code.
>
> <s:a href="%{delete}" 
> preInvokeJS="confirm('%{getText('confirm-delete')}')">
>     <s:text name="record.delete"/>
> </s:a>
>
> The anchor works properly, except that it does not call the confirm()
> method. The generated HTML gives me this code:
>
> <a href="/sed/listUsers!delete.do?id=1">Deletar</a>
>
> And there's no occurrence of the word "confirm" in the whole HTML code
> nor there's any reference to an external JS file.
>
> I presume I'm not missing anything. Any guess whether this feature is
> actually working or not?
>
> Célio.
>
> ---------------------------------------------------------------------
> 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