You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anjib Mulepati <an...@hotmail.com> on 2011/08/16 16:45:17 UTC

Does jQuery work with Struts 1.3.8 custom tag?

I have following code with drop-list name "agencyName". But event 
.change() attached to this object never called. So i was wondering does 
jQuery ever work with Struts custom tag? or Am I doing something wrong?
Thanks in advance.

Anjib

<script type="text/javascript" src="js/jquery.js"></script>
<script>

     $('#agencyName').change( function() {
         /* Never called here */
         alert($('select#agencyName').val());
         $.ajax({
             url: "getGroupList.do",
             data: "agencyName=" + $('select#agencyName').val()
         })
     } );

</script>

<div id="topOptions">
<table>
<tr valign="top">
<td width="49%">
<html:form action="/addUserToAgencyAndGroup"  styleId="addBulkEmail">

<h1><bean:message key="title.addToAgency" /></h1>

<label for="agencyName" class="formLabel">
<bean:message key="common.organizationalUnit" />
</label>
<html:select title="Agency Name" styleId="agencyName" 
property="agencyName" tabindex="1">
<% ArrayList<String> agencyList = new ArrayList<String>();
                             agencyList = (ArrayList<String>) 
request.getAttribute("agencyList");
                             for (int i = 0; i < agencyList.size(); i++) {%>
<html:option value='<%= agencyList.get(i)%>'/>
<% }%>
</html:select>

<label for="groupName" class="formLabel">
<bean:message key="common.group" />
</label>
<html:select title="Group" styleId="groupName" property="groupName" 
tabindex="2">
</html:select><br/>

<label for="bulkEmail">
<bean:message key="option2.msg" />
</label>
<html:textarea cols="70" rows="5"  property="emails" styleId="emails" 
value="" /><br/>

<input title="Add Emails" type="submit" value="Add All" />

</html:form>
</td>
</tr>
</table>
</div>

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


Re: Does jQuery work with Struts 1.3.8 custom tag?

Posted by Eric Lentz <Er...@sherwin.com>.
> Yes script runs fine.

I would suggest making it as simple as possible. For example, take your 
rendered form and make a html file out it and take your script and the 
jQuery framework and place them all on a file system and attempt to get 
that working (comment the ajax part out). If that works, then start laying 
in complexity until it breaks and then you'll know where the problem is.

Re: Does jQuery work with Struts 1.3.8 custom tag?

Posted by Dave Newton <da...@gmail.com>.
What script? The script that attaches the handler?

Dave
 On Aug 16, 2011 1:46 PM, "Anjib Mulepati" <an...@hotmail.com> wrote:
> Yes script runs fine.
> On 8/16/2011 1:19 PM, Eric Lentz wrote:
>>> There is no error at console but can run the script in console itself.
>>> Any suggestion?
>> Are you saying that you can verify that the script is executing? For
>> example, if you alert, breakpoint or print to console before the
>> installation of the change event, do you get the expected feedback from
>> the script?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

Re: Does jQuery work with Struts 1.3.8 custom tag?

Posted by Anjib Mulepati <an...@hotmail.com>.
Yes script runs fine.
On 8/16/2011 1:19 PM, Eric Lentz wrote:
>> There is no error at console but can run the script in console itself.
>> Any suggestion?
> Are you saying that you can verify that the script is executing? For
> example, if you alert, breakpoint or print to console before the
> installation of the change event, do you get the expected feedback from
> the script?


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


Re: Does jQuery work with Struts 1.3.8 custom tag?

Posted by Eric Lentz <Er...@sherwin.com>.
> There is no error at console but can run the script in console itself.
> Any suggestion?

Are you saying that you can verify that the script is executing? For 
example, if you alert, breakpoint or print to console before the 
installation of the change event, do you get the expected feedback from 
the script?

Re: Does jQuery work with Struts 1.3.8 custom tag?

Posted by Anjib Mulepati <an...@hotmail.com>.
There is no error at console but can run the script in console itself. 
Any suggestion?

On 8/16/2011 12:53 PM, Dave Newton wrote:
> Check for JS errors in the console then, jQuery works fine with S1.
>
> Dave
>   On Aug 16, 2011 12:44 PM, "Anjib Mulepati"<an...@hotmail.com>  wrote:
>> On 8/16/2011 10:51 AM, Eric Lentz wrote:
>>>> I have following code with drop-list name "agencyName". But
>>> event.change() attached to this object never called.
>>>
>>> Make sure that the rendered form is actually creating a HTML object with
>>> an ID of agencyName. That's usually the problem that I encounter - using
>>> the wrong name. Also, make sure that your script is actually being
> loaded.
>>> Firebug would be a good way to check that. That's another common issue
>>> (for me anyway). jQuery is independent of any server-side framework, so
> it
>>> definitely works with S1.
>> 1. Make sure that the rendered form is actually creating a HTML object
>> with an ID of agencyName.
>> It is rendered<select name="agencyName" tabindex="1"
>> id="agencyName" title="Agency Name">
>> 2. Also, make sure that your script is actually being loaded.
>> It is also loaded. I can see in the list of loaded script in Firebug.
>>
>> ---------------------------------------------------------------------
>> 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: Does jQuery work with Struts 1.3.8 custom tag?

Posted by Dave Newton <da...@gmail.com>.
Check for JS errors in the console then, jQuery works fine with S1.

Dave
 On Aug 16, 2011 12:44 PM, "Anjib Mulepati" <an...@hotmail.com> wrote:
> On 8/16/2011 10:51 AM, Eric Lentz wrote:
>>> I have following code with drop-list name "agencyName". But
>> event.change() attached to this object never called.
>>
>> Make sure that the rendered form is actually creating a HTML object with
>> an ID of agencyName. That's usually the problem that I encounter - using
>> the wrong name. Also, make sure that your script is actually being
loaded.
>> Firebug would be a good way to check that. That's another common issue
>> (for me anyway). jQuery is independent of any server-side framework, so
it
>> definitely works with S1.
> 1. Make sure that the rendered form is actually creating a HTML object
> with an ID of agencyName.
> It is rendered <select name="agencyName" tabindex="1"
> id="agencyName" title="Agency Name">
> 2. Also, make sure that your script is actually being loaded.
> It is also loaded. I can see in the list of loaded script in Firebug.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

Re: Does jQuery work with Struts 1.3.8 custom tag?

Posted by Anjib Mulepati <an...@hotmail.com>.
On 8/16/2011 10:51 AM, Eric Lentz wrote:
>> I have following code with drop-list name "agencyName". But
> event.change() attached to this object never called.
>
> Make sure that the rendered form is actually creating a HTML object with
> an ID of agencyName. That's usually the problem that I encounter - using
> the wrong name. Also, make sure that your script is actually being loaded.
> Firebug would be a good way to check that. That's another common issue
> (for me anyway). jQuery is independent of any server-side framework, so it
> definitely works with S1.
1. Make sure that the rendered form is actually creating a HTML object 
with an ID of agencyName.
      It is rendered <select name="agencyName" tabindex="1" 
id="agencyName" title="Agency Name">
2. Also, make sure that your script is actually being loaded.
      It is also loaded. I can see in the list of loaded script in Firebug.

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


Re: Does jQuery work with Struts 1.3.8 custom tag?

Posted by Eric Lentz <Er...@sherwin.com>.
> I have following code with drop-list name "agencyName". But 
event.change() attached to this object never called.

Make sure that the rendered form is actually creating a HTML object with 
an ID of agencyName. That's usually the problem that I encounter - using 
the wrong name. Also, make sure that your script is actually being loaded. 
Firebug would be a good way to check that. That's another common issue 
(for me anyway). jQuery is independent of any server-side framework, so it 
definitely works with S1.