struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sanjay Choudhary <java...@yahoo.com>
Subject RE: check box - Attn. Ted Husted, Craig
Date Wed, 20 Mar 2002 03:54:44 GMT
Thanks Michael,

It worked but it couldn't use 
document.localForm.selectAll.checked;
instead I used document.forms[0].selectAll.checked;

1. Is there a way to assign a form name with tag
html:form of struts?

2. I will like to control a data entry on my form for
certain fields using javascript. E.g. if in
html:checkbox - a user checks then I will allow enable
html:text field for dataentry else it will be
disabled. I think controlling these functions on
server side will be too expensive. What is the easy
way to refer or pass these controls/fields created
using html:text, html:checkbox etc. in javascripts.

E.G. if I want the value of field <html:text
property="abc" name=<somebean>/> in the javascript.
or wish to enable or disable this field thru
javascript.


All comments appreciated

-Sanjay







--- Michael Skariah <mskariah@anshinsoft.com> wrote:
> Hi Sanjay,
> 
> Let me give an example to help you out here. Here I
> am assuming that the
> checkboxes (including the master checkbox) are
> present in a table that has
> got an id 'checkTable'. When I say 'master' check
> box I mean the one that
> will help you to trigger the event for
> selecting/de-selecting the other
> child checkboxes.
> 
> In the form you can have something like this
> <html:checkbox property="selectAll"
> onclick="checkAll()"/>
> for the master checkbox.
> 
> And the javascript code could be something like this
> function checkAll()
> {
> 	var rowCount = checkTable.rows.length;
> 	for (var i=1; i < rowCount; i++)
> 	{
> 		checkTable.rows(i).cells(0).childNodes(0).checked
> =
> document.localForm.selectAll.checked;
> 	}
> }
> 
> See if this help.
> 
> Cheers!,
> -Michael.
> 
> 
> 
> -----Original Message-----
> From: Sanjay Choudhary [mailto:java_sc@yahoo.com]
> Sent: Tuesday, March 19, 2002 5:26 PM
> To: Struts Users Mailing List
> Subject: check box
> 
> 
> In our application, we are showing a list of records
> using nested tag. In front of each record we have a
> select/check box mapped to a property in a bean.
> 
> We wish to provide a functionality to users by
> placing
> a checkbox  at the top row (this is not mapped to
> any
> property in bean) and on click of this check box we
> wish to mark all the check boxes shown in the list.
> (Exactly like we have in yahoo and hotmail main
> display page, where in an user checks a box and
> everything is selected). I think javascript is a way
> to go here.
> 
> 
> But how do I configure things like html:form name,
> html:checkbox name - also how do I access the check
> box for each record displayed to mark them.
> 
> Is there a sample project on resource site where we
> can find some code to help us out to use javascripts
> with struts.
> 
> -Sanjay
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - live college hoops coverage
> http://sports.yahoo.com/
> 
> --
> To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/

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


Mime
View raw message