Re: Retriving a form content for the selected html:checkbox

2008-02-26 Thread stanlick
If I remember correctly, the checkbox expects a get/set even though the POJO
std for a boolean is typically is/set.

Scott

On Tue, Feb 26, 2008 at 2:11 AM, Laurie Harper <[EMAIL PROTECTED]> wrote:

> Tanmay Waikar wrote:
> >
> > Hi,
> >
> > I am iterating my form bean values using logic:iterate tag.  I have a
> > html:checkbox which will simultaneously get iterated with the values.
> >
> > My requirement is to fetch the selected values  of the grid on press of
> > submit button in the action class.
>
> What problem are you having? As long as your checkboxes are mapped to a
> property in the form bean (which needs to be an indexed property, since
> it will hold multiple values) this should work.
>
> L.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Scott
[EMAIL PROTECTED]


Re: Retriving a form content for the selected html:checkbox

2008-02-26 Thread Laurie Harper

Tanmay Waikar wrote:


Hi, 


I am iterating my form bean values using logic:iterate tag.  I have a
html:checkbox which will simultaneously get iterated with the values.

My requirement is to fetch the selected values  of the grid on press of
submit button in the action class. 


What problem are you having? As long as your checkboxes are mapped to a 
property in the form bean (which needs to be an indexed property, since 
it will hold multiple values) this should work.


L.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Retriving a form content for the selected html:checkbox

2008-02-23 Thread Tanmay Waikar


Hi, 

I am iterating my form bean values using logic:iterate tag.  I have a
html:checkbox which will simultaneously get iterated with the values.

My requirement is to fetch the selected values  of the grid on press of
submit button in the action class. 

Thanks
-- 
View this message in context: 
http://www.nabble.com/Retriving-a-form-content-for-the-selected-html%3Acheckbox-tp15650951p15650951.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: html:checkbox value show object refrence

2007-04-20 Thread Dave Newton
--- Chandrakant wrote:
>  value="  value='${annuitType.annuitid}'>
>">
> 

You can't nest tags like that.

Depending on what version of servlet/jsp your
container supports you can either use JSP EL directly
or the struts-el tags.

d.


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



html:checkbox value show object refrence

2007-04-20 Thread Chandrakant

Hi All,

I created action form which contains List holding Id and name fields.
In JSP I use 
  
  
  

When I see the source page the output is like 

  
  

In value I get refrence.

If I use normal http://www.patni.com
World-Wide Partnerships. World-Class Solutions. 
_ 

This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to whom this
message was originally addressed. Any review, e-transmission dissemination
or other use of or taking of any action in reliance upon this information by
persons or entities other than the intended recipient is prohibited. If you
have received this e-mail in error kindly delete this e-mail from your
records. If it appears that this mail has been forwarded to you without
proper authority, please notify us immediately at [EMAIL PROTECTED] and
delete this mail.  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problems Checking and Array of html:checkbox

2006-09-27 Thread Uday Chandra Karrothi

Here is peace of code that i used .

It uses a strign array to set the checkboxes and then get the values(
in action form) selected as well.Have you tried using a multibox.


.
   
  
 
  
  
  ...


selectedAssets is an array that you can populate with the values

so yeah
Basically try using multibox. I hope that will help you in settign and
getting the values of the checkboxes.

Thank you
Uday




On 9/27/06, yamilka vallejo ramos <[EMAIL PROTECTED]> wrote:

Please I have and Array of html:checkbox, but that array it of Long[] and I
don't kwon how to say checked = true













every element "tipoDon" of my list "listadoTiposDonante" has a boolean and I
dont kwon how too work with that

please if any boby could help me i will presure, thanks





--
Never explain--your friends do not need it and your enemies will not
believe you anyway--Elbert Hubbard

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problems Checking and Array of html:checkbox

2006-09-27 Thread yamilka vallejo ramos

Please I have and Array of html:checkbox, but that array it of Long[] and I
don't kwon how to say checked = true













every element "tipoDon" of my list "listadoTiposDonante" has a boolean and I
dont kwon how too work with that

please if any boby could help me i will presure, thanks


Re: html:checkbox issue

2006-08-10 Thread Adam Gordon

David-

Since I've only one checkbox, I think that's way overkill...regardless, 
I should take back my prior comment about the documentation for struts:


http://struts.apache.org/1.x/struts-taglib/tlddoc/index.html has a 
WARNING about how to make struts have the ability to detect unchecked 
checkboxes.  It's amazing how RTFM results in user education...


Incidentally, I believe this is basically the same as what Kalpesh 
suggests in the follow up email...


-Adam

David Durham wrote:

Adam Gordon wrote:
I've got an html:checkbox in a form and the property is 
mapped/spelled correctly to the field/method in the bean.  The 
behavior I am seeing is that the bean property (a boolean) is not 
being set based on the state of the checkbox.


I fired up Ethereal and following the TCP stream from the POST, I can 
see the name of the property being passed (=on) as a 
parameter on the request if the checkbox is checked, but if it is not 
checked, the parameter doesn't show up at all on the request (I'd 
expected =off) but this might be the reason that 
Struts can't set the property if it doesn't know the value


Obviously, I can issue a request.getParameter() and if 
it returns null, set the property on the bean myself, but I had hoped 
Struts would do this for me...


Anyone run into this before or have any suggestions?  Thanks.


Try using multibox.  I think it will do what you need.

http://husted.com/struts/tips/007.html

-Dave


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: html:checkbox issue

2006-08-10 Thread kalpesh modi
You can keep the default value for the checkbox field to be "off" in the form 
bean. It will be set to "on" only if the checkbox is checked on the JSP.

Thanks,
-Kalpesh

Adam Gordon <[EMAIL PROTECTED]> wrote: I'm sure this is a coding problem (they 
usually are...) on the server-side:

I've got an html:checkbox in a form and the property is mapped/spelled 
correctly to the field/method in the bean.  The behavior I am seeing is 
that the bean property (a boolean) is not being set based on the state 
of the checkbox.

I fired up Ethereal and following the TCP stream from the POST, I can 
see the name of the property being passed (
=on) as a 
parameter on the request if the checkbox is checked, but if it is not 
checked, the parameter doesn't show up at all on the request (I'd 
expected 
=off) but this might be the reason that Struts 
can't set the property if it doesn't know the value

Obviously, I can issue a request.getParameter(
) and if it 
returns null, set the property on the bean myself, but I had hoped 
Struts would do this for me...

Anyone run into this before or have any suggestions?  Thanks.

-- adam


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







-
Stay in the know. Pulse on the new Yahoo.com.  Check it out. 

Re: html:checkbox issue

2006-08-10 Thread David Durham

Adam Gordon wrote:
I've got an html:checkbox in a form and the property is mapped/spelled 
correctly to the field/method in the bean.  The behavior I am seeing is 
that the bean property (a boolean) is not being set based on the state 
of the checkbox.


I fired up Ethereal and following the TCP stream from the POST, I can 
see the name of the property being passed (=on) as a 
parameter on the request if the checkbox is checked, but if it is not 
checked, the parameter doesn't show up at all on the request (I'd 
expected =off) but this might be the reason that Struts 
can't set the property if it doesn't know the value


Obviously, I can issue a request.getParameter() and if it 
returns null, set the property on the bean myself, but I had hoped 
Struts would do this for me...


Anyone run into this before or have any suggestions?  Thanks.


Try using multibox.  I think it will do what you need.

http://husted.com/struts/tips/007.html

-Dave


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



html:checkbox issue

2006-08-10 Thread Adam Gordon

I'm sure this is a coding problem (they usually are...) on the server-side:

I've got an html:checkbox in a form and the property is mapped/spelled 
correctly to the field/method in the bean.  The behavior I am seeing is 
that the bean property (a boolean) is not being set based on the state 
of the checkbox.


I fired up Ethereal and following the TCP stream from the POST, I can 
see the name of the property being passed (=on) as a 
parameter on the request if the checkbox is checked, but if it is not 
checked, the parameter doesn't show up at all on the request (I'd 
expected =off) but this might be the reason that Struts 
can't set the property if it doesn't know the value


Obviously, I can issue a request.getParameter() and if it 
returns null, set the property on the bean myself, but I had hoped 
Struts would do this for me...


Anyone run into this before or have any suggestions?  Thanks.

-- adam


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: html:checkbox not storing property

2006-06-15 Thread Sebastian Stein
Samere, Adam J <[EMAIL PROTECTED]> [060615 15:20]:
> Browsers do not send a request parameter for check boxes that are not
> checked. Input of type text is always sent. I'm guessing what you see is
> the box not being "unchecked"... You need to set it in the reset method.

Great, this was already the solution. Thanks!


Sebastian
-- 
http://www.halle-ist-schoen.de/
Bilddokumentation der schoensten Saalestadt

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: html:checkbox not storing property

2006-06-15 Thread Samere, Adam J
Browsers do not send a request parameter for check boxes that are not
checked. Input of type text is always sent. I'm guessing what you see is
the box not being "unchecked"... You need to set it in the reset method.

-Original Message-
From: Sebastian Stein [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 15, 2006 9:08 AM
To: Struts Users Mailing List
Subject: html:checkbox not storing property

Hi folks,


I have a jsp page with a struts html:checkbox looking as follows:



The backupform is defined in struts-config.xml as:



If I enter the page, the state of the checkbox is correctly set.
However, when I leave the page, the value of the checkbox is not
preserved. I debugged this a little bit and noticed that in the
BackupForm class first the reset(...) function is called and later the
isEnable() function, but not the setEnable(boolean e) function.

This is very strange, because in the same form I have another input
defined as follows:



Here the correct value is set during page load as well as after
forwarding to the next page. While leaving the page first the reset(...)
function of the BackupForm class is called, afterwards the
setPath(String p) function and later several times the getPath()
function.

So where is the difference between a html:checkbox and a html:text?

By the way, I'm using Struts 1.1.


Sebastian

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
The information contained in this message may be privileged,
confidential, and protected from disclosure. If the reader of this
message is not the intended recipient, or any employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution, or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately
by replying to the message and deleting it from your computer.

Thank you. Paychex, Inc.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



html:checkbox not storing property

2006-06-15 Thread Sebastian Stein
Hi folks,


I have a jsp page with a struts html:checkbox looking as follows:



The backupform is defined in struts-config.xml as:



If I enter the page, the state of the checkbox is correctly set. However,
when I leave the page, the value of the checkbox is not preserved. I
debugged this a little bit and noticed that in the BackupForm class first
the reset(...) function is called and later the isEnable() function, but not
the setEnable(boolean e) function.

This is very strange, because in the same form I have another input defined
as follows:



Here the correct value is set during page load as well as after forwarding
to the next page. While leaving the page first the reset(...) function of
the BackupForm class is called, afterwards the setPath(String p) function
and later several times the getPath() function.

So where is the difference between a html:checkbox and a html:text?

By the way, I'm using Struts 1.1.


Sebastian

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



html:checkbox

2006-05-05 Thread fea jabi

Have an Object Customer
Name
Address
isEligibleCustomer  -- boolean


In the Prepare action
Created list of these Customer objects.

and this customer list is set to request.

want to check the checkbox according to the value of the Object 
isEligibleCustomer of Customer object.


not sure how to do this. The form of the jsp is not having the 
isEligibleCustomer .


Tried with below code. getting exception that there is no getter method in 
the form. how to get the value of the object Customer? what should be the 
property value of the html:checkbox?


In jsp

requestURI="PrepareAction.do" >

..
..


  

...
.



Thanks.

_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: *****POSSIBLE SPAM***** Re: html:checkbox entries are not disappering

2006-04-28 Thread Hans-Peter Petek
Hi,

this is correct, but how do I know which objects set to null and which not?

I have an ArrayList with Objects (Users), one parameter of the user is
"assigned" (of bool).
With the list I can assign some of the users and can store this (submit the
form). The index of the parameter is counted from 0 ... so, 0, 1, 2, ... so
I don´t know from the request-parameters which objects are choosen and which
not (the id of the user is huge number). So, how to map the request
parameters to my user-objects so that I can set the "assigned" to false.

Thanks in advance
HP


-Ursprüngliche Nachricht-
Von: Rick Reumann [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 21. April 2006 14:42
An: Struts Users Mailing List
Betreff: *POSSIBLE SPAM***** Re: html:checkbox entries are not
disappering

Hans-Peter Petek wrote:
>  
> But, when I deselect a checkbox, press the button (i.e. submit), all 
> the previous checked checkboxes are still checked .. =?!?!? Every 
> checkbox I ever checked once still remains checked ...
> 
> Can anyone help me ...

Common problem. Make sure you are setting all your boolean values
represented by the checkboxes to false in your form's reset method.

(Your form bean probably has session scope and remember in html only
checkboxes that are checked get passed with the request, so behind the
scenes your formBean still has some of its properties set to true.)

--
Rick
http://www.learntechnology.net

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: html:checkbox entries are not disappering

2006-04-21 Thread Rick Reumann

Hans-Peter Petek wrote:
 
But, when I deselect a checkbox, press the button (i.e. submit), all the

previous checked checkboxes are still checked .. =?!?!? Every checkbox I
ever checked once still remains checked ...

Can anyone help me ...


Common problem. Make sure you are setting all your boolean values 
represented by the checkboxes to false in your form's reset method.


(Your form bean probably has session scope and remember in html only 
checkboxes that are checked get passed with the request, so behind the 
scenes your formBean still has some of its properties set to true.)


--
Rick
http://www.learntechnology.net

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



html:checkbox entries are not disappering

2006-04-21 Thread Hans-Peter Petek
Hello all,

following problem ...
I have a list of entries (arraylist) and I am able to check them (with a
checkbox).
I can check for example 3 of 5 entries and press the save button ... (some
action behind) ... and the 3 entries are checked -> all fine.

But, when I deselect a checkbox, press the button (i.e. submit), all the
previous checked checkboxes are still checked .. =?!?!? Every checkbox I
ever checked once still remains checked ...

Can anyone help me ...

ActionForm:
public class LecturerTeamMemberForm extends ActionForm {

private ArrayList teamlist;

+ getter / setter ...

jsp:


  
 



The output (request) shows only the assigned checkboxes .. is there an error
in the mapping of struts or do I miss something?

Output: e.g. checkbox 1 and 3 selected
teamlist[0].assigned -> on
teamlist[2].assigned -> on

No entry of [1] ...

But if I have selected entry 2 (index 1) once before, the checkbox is always
selected after submitting ... but there is no entry of "teamlist[1].assigned
-> on" in the request.

Help would be great, I think its just a small problem ...

kind regards,
HP




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



validating mutiple html:checkbox values

2006-02-07 Thread Christopher Becker


I have a form in a Struts 1.2.7 app that displays a dynamic list of html:checkbox fields, all having the same property value (property=choseRole), which I present using a c:forEach tag.  I wish to apply validation to this set of checkboxes, and I am currently using the Validator plugin on all forms in the app. I have a formbean that extends the ValidatorForm for this particular form.
 
I have two questions:
1) How do I represent choseRole as a field in the formbean?  and
2) How do I get the validator to see this multivalued property?
 
I need some kind of dynamic value, as the list of checkboxes can change in size. I have tried ArrayList, Vector, etc. without success. I also tried using multibox instead of checkbox.
 
I can get the validator to work by using a String value (just to test the 'required' validation) but if more than one checkbox is selected, only one returns if other fields of the form fail the validation test.
 
Any guidance or insight would be appreciated... thanks!
Regards,
 
--Chris
 
 
 
Chris BeckerSenior Programmer/AnalystEnterprise IT(516) 803-3921[EMAIL PROTECTED]BEGIN:VCARD
VERSION:2.1
X-GWTYPE:USER
FN:Becker, Christopher
TEL;WORK:(516)803-3921
ORG:;Corporate Information Systems
TEL;PREF;FAX:(516)803-6115
EMAIL;WORK;PREF:[EMAIL PROTECTED]
N:Becker;Christopher
TITLE:Sr., Programmer/Analyst
ADR;DOM;WORK;PARCEL;POSTAL:New York
LABEL;DOM;WORK;PARCEL;POSTAL;ENCODING=QUOTED-PRINTABLE:Becker, Christopher=0A=
New York
END:VCARD


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

RE: Conditionally checking an html:checkbox field

2006-02-01 Thread Greg Dunn
N/M, I found it.  I was creating the form in session in my first action
but pulling it from request in my second.  Duh.

-Original Message-
From: Greg Dunn [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 01, 2006 11:05 AM
To: Struts Users Mailing List
Subject: RE: Conditionally checking an html:checkbox field

Still no joy using String instead of Boolean.  I must be doing something
wrong.  What are common mistakes related to checkboxes?

-Original Message-
From: kalpesh modi [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 31, 2006 1:11 PM
To: Struts Users Mailing List
Subject: RE: Conditionally checking an html:checkbox field

You need to set it to the value that gets submitted when you check a
checkbox and submit the form. 



-
Bring words and photos together (easily) with
 PhotoMail  - it's free and works with Yahoo! Mail.



-Original Message-
From: Greg Dunn [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 31, 2006 12:57 PM
To: Struts Users Mailing List
Subject: RE: Conditionally checking an html:checkbox field


I need to conditionally set a checkbox field when presented to the user
depending on application configuration settings.  I'm using an Action to
load the form and attempt to set the checkbox field.  No matter what I
do I cannot get the checkbox state to change from its default, whether
that be true, false or no value (shows false). 

I've Google'ed, searched the list archive and various FAQ's to no avail.



In my ValidatorForm bean:  (This particular field is not validated)

private boolean shutoff;

public boolean getShutoff () {
return shutoff;
}

public void setShutoff (boolean shutoff) {
this.shutoff = shutoff;
}

public void reset(ActionMapping mapping, HttpServletRequest request)
{
this.shutoff = boolean.FALSE;
}

In my Action:

if (checkTheBox.equals("yes")) {  //config. option, confirmed
working
regForm.setShutoff(true);
}

[Then it immediately forwards to the form JSP.]



I also tried setting the value of the checkbox via another property in
the form bean.

I appreciate any corrections or suggestions.

Greg

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Conditionally checking an html:checkbox field

2006-02-01 Thread Greg Dunn
Still no joy using String instead of Boolean.  I must be doing something
wrong.  What are common mistakes related to checkboxes?

-Original Message-
From: kalpesh modi [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 31, 2006 1:11 PM
To: Struts Users Mailing List
Subject: RE: Conditionally checking an html:checkbox field

You need to set it to the value that gets submitted when you check a
checkbox and submit the form. 



-
Bring words and photos together (easily) with
 PhotoMail  - it's free and works with Yahoo! Mail.



-Original Message-
From: Greg Dunn [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 31, 2006 12:57 PM
To: Struts Users Mailing List
Subject: RE: Conditionally checking an html:checkbox field


I need to conditionally set a checkbox field when presented to the user
depending on application configuration settings.  I'm using an Action to
load the form and attempt to set the checkbox field.  No matter what I
do I cannot get the checkbox state to change from its default, whether
that be true, false or no value (shows false). 

I've Google'ed, searched the list archive and various FAQ's to no avail.



In my ValidatorForm bean:  (This particular field is not validated)

private boolean shutoff;

public boolean getShutoff () {
return shutoff;
}

public void setShutoff (boolean shutoff) {
this.shutoff = shutoff;
}

public void reset(ActionMapping mapping, HttpServletRequest request)
{
this.shutoff = boolean.FALSE;
}

In my Action:

if (checkTheBox.equals("yes")) {  //config. option, confirmed
working
regForm.setShutoff(true);
}

[Then it immediately forwards to the form JSP.]



I also tried setting the value of the checkbox via another property in
the form bean.

I appreciate any corrections or suggestions.

Greg

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Conditionally checking an html:checkbox field

2006-01-31 Thread kalpesh modi
I never tried with boolean but try making it a String. It should work with a 
String. 



-
 Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new 
and used cars.

RE: Conditionally checking an html:checkbox field

2006-01-31 Thread Greg Dunn
I'll try that, but this property is a boolean so I'm actually not
getting a string when the checkbox is submitted, it has no value
attribute.  I'm getting and working with the boolean in the ultimate
form submit Action without any problems.  

Do I HAVE to set a String value attribute to get it do what I want?


-Original Message-
From: kalpesh modi [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 31, 2006 1:11 PM
To: Struts Users Mailing List
Subject: RE: Conditionally checking an html:checkbox field

You need to set it to the value that gets submitted when you check a
checkbox and submit the form. 



-
Bring words and photos together (easily) with
 PhotoMail  - it's free and works with Yahoo! Mail.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Conditionally checking an html:checkbox field

2006-01-31 Thread kalpesh modi
You need to set it to the value that gets submitted when you check a checkbox 
and submit the form. 



-
Bring words and photos together (easily) with
 PhotoMail  - it's free and works with Yahoo! Mail.

RE: Conditionally checking an html:checkbox field

2006-01-31 Thread Greg Dunn
I think that's what I'm doing, but it isn't working.

Am I doing this wrong? (from my original post):

In my Action:

if (checkTheBox.equals("yes")) {  //config. option, confirmed
working
regForm.setShutoff(true);
}

[Then it immediately forwards to the JSP.]


-Original Message-
From: kalpesh modi [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 31, 2006 12:52 PM
To: Struts Users Mailing List
Subject: Re: Conditionally checking an html:checkbox field

Try the check condition in your action class and set/not set the
checkbox and then forward it to the JSP.

Hope this helps.



-
 
 What are the most popular cars? Find out at Yahoo! Autos 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Conditionally checking an html:checkbox field

2006-01-31 Thread kalpesh modi
Try the check condition in your action class and set/not set the checkbox and 
then forward it to the JSP.

Hope this helps.



-
 
 What are the most popular cars? Find out at Yahoo! Autos 

Conditionally checking an html:checkbox field

2006-01-31 Thread Greg Dunn
I need to conditionally set a checkbox field when presented to the user
depending on application configuration settings.  I'm using an Action to
load the form and attempt to set the checkbox field.  No matter what I
do I cannot get the checkbox state to change from its default, whether
that be true, false or no value (shows false). 

I've Google'ed, searched the list archive and various FAQ's to no avail.



In my ValidatorForm bean:  (This particular field is not validated)

private boolean shutoff;

public boolean getShutoff () {
return shutoff;
}

public void setShutoff (boolean shutoff) {
this.shutoff = shutoff;
}

public void reset(ActionMapping mapping, HttpServletRequest request)
{
this.shutoff = boolean.FALSE;
}

In my Action:

if (checkTheBox.equals("yes")) {  //config. option, confirmed
working
regForm.setShutoff(true);
}

[Then it immediately forwards to the form JSP.]



I also tried setting the value of the checkbox via another property in
the form bean.

I appreciate any corrections or suggestions.

Greg



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Conditionally checking an html:checkbox field

2006-01-31 Thread Greg Dunn
I need to conditionally set a checkbox field when presented to the user
depending on application configuration settings.  I'm using an Action to
load the form and attempt to set the checkbox field.  No matter what I
do I cannot get the checkbox state to change from its default, whether
that be true, false or no value (shows false). 

I've Google'ed, searched the list archive and various FAQ's to no avail.



In my ValidatorForm bean:  (This particular field is not validated)

private boolean shutoff;

public boolean getShutoff () {
return shutoff;
}

public void setShutoff (boolean shutoff) {
this.shutoff = shutoff;
}

public void reset(ActionMapping mapping, HttpServletRequest request)
{
this.shutoff = boolean.FALSE;
}

In my Action:

if (checkTheBox.equals("yes")) {  //config. option, confirmed
working
regForm.setShutoff(true);
}

[Then it immediately forwards to the form JSP.]



I also tried setting the value of the checkbox via another property in
the form bean.

I appreciate any corrections or suggestions.

Greg



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: struts html:checkbox value

2006-01-26 Thread Vidya \(Suvarna\) Mahavadi
Thanks for all the responses. It helped me to find an alternative for
this. I am using a property for the 'disabled' in my bean and if it is
true I am setting the checkbox properties. 

Vidya

-Original Message-
From: Niall Pemberton [mailto:[EMAIL PROTECTED] 
Sent: Thursday 26 January 2006 13:04
To: Struts Users Mailing List
Subject: Re: struts html:checkbox value

On 1/26/06, Vidya (Suvarna) Mahavadi <[EMAIL PROTECTED]> wrote:
> Is there a work around for this..

Not a simple one - for text or textarea elements the "readonly"
attribute would do the job you're looking for, but from memory
"readonly" isn't part of the html 4 standard for checkbox.

One approach you could take is to render a checkbox and a hidden field
and use some JavaScript to change the value of the hidden field.

Alternatively you could use either the logic tags or JSTL to render
different elements depending on some condition - i.e. either a
checkbox (enabled) or a hidden field and value (disabled).

Niall

> -Original Message-
> From: Niall Pemberton [mailto:[EMAIL PROTECTED]
> Sent: Thursday 26 January 2006 12:24
>
> On 1/26/06, Vidya (Suvarna) Mahavadi <[EMAIL PROTECTED]> wrote:
> >
> > Hi ,
> >
> > If a check box is disabled and checked does it submit the value
true?
> I
> > have a situation where it is not submitting the disabled checkbox
> > properties. Is there a work around for this...
>
> This is a browser / HTTP isssue - disabled fields don't get submitted.
>
> Niall

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

This message and any attachments are confidential and intended solely for the 
addressee. If you have received this message in error, please notify Discovery 
immediately, telephone number +27 11 529 2888. Any unauthorised use; alteration 
or dissemination of the contents of this email is strictly prohibited. In no 
event will Discovery or the sender be liable in any manner whatsoever to any 
person for any loss or any direct, indirect, special or consequential damages 
arising from use of this email or any linked website, including, without 
limitation, from any lost profits, business interruption, loss of programmes or 
other data that may be stored on any information handling system or otherwise 
from any assurance that this email is virus free even if Discovery is expressly 
advised of the possibility of such damages. Discovery is an Authorised 
Financial Services Provider.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: struts html:checkbox value

2006-01-26 Thread Niall Pemberton
On 1/26/06, Vidya (Suvarna) Mahavadi <[EMAIL PROTECTED]> wrote:
> Is there a work around for this..

Not a simple one - for text or textarea elements the "readonly"
attribute would do the job you're looking for, but from memory
"readonly" isn't part of the html 4 standard for checkbox.

One approach you could take is to render a checkbox and a hidden field
and use some JavaScript to change the value of the hidden field.

Alternatively you could use either the logic tags or JSTL to render
different elements depending on some condition - i.e. either a
checkbox (enabled) or a hidden field and value (disabled).

Niall

> -Original Message-
> From: Niall Pemberton [mailto:[EMAIL PROTECTED]
> Sent: Thursday 26 January 2006 12:24
>
> On 1/26/06, Vidya (Suvarna) Mahavadi <[EMAIL PROTECTED]> wrote:
> >
> > Hi ,
> >
> > If a check box is disabled and checked does it submit the value true?
> I
> > have a situation where it is not submitting the disabled checkbox
> > properties. Is there a work around for this...
>
> This is a browser / HTTP isssue - disabled fields don't get submitted.
>
> Niall

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: struts html:checkbox value

2006-01-26 Thread Tamas Szabo
On 1/26/06, Vidya (Suvarna) Mahavadi <[EMAIL PROTECTED]> wrote:
>
> Is there a work around for this..



Can the user change the value of the checkboxes?
I mean they are always disabled or you enable/disable them dynamically?

Tamas


RE: struts html:checkbox value

2006-01-26 Thread Vidya \(Suvarna\) Mahavadi
Is there a work around for this..

-Original Message-
From: Niall Pemberton [mailto:[EMAIL PROTECTED] 
Sent: Thursday 26 January 2006 12:24
To: Struts Users Mailing List
Subject: Re: struts html:checkbox value

On 1/26/06, Vidya (Suvarna) Mahavadi <[EMAIL PROTECTED]> wrote:
>
> Hi ,
>
> If a check box is disabled and checked does it submit the value true?
I
> have a situation where it is not submitting the disabled checkbox
> properties. Is there a work around for this...

This is a browser / HTTP isssue - disabled fields don't get submitted.

Niall

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

This message and any attachments are confidential and intended solely for the 
addressee. If you have received this message in error, please notify Discovery 
immediately, telephone number +27 11 529 2888. Any unauthorised use; alteration 
or dissemination of the contents of this email is strictly prohibited. In no 
event will Discovery or the sender be liable in any manner whatsoever to any 
person for any loss or any direct, indirect, special or consequential damages 
arising from use of this email or any linked website, including, without 
limitation, from any lost profits, business interruption, loss of programmes or 
other data that may be stored on any information handling system or otherwise 
from any assurance that this email is virus free even if Discovery is expressly 
advised of the possibility of such damages. Discovery is an Authorised 
Financial Services Provider.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: struts html:checkbox value

2006-01-26 Thread Pham Anh Tuan

I think you should compare the original data with the submited data,

ex: before you submit new changes, you have 5 checked box, after that, you 
choose only 3 checkbox are checked, so, after your form is submited, you 
should check the differences...


hiz, hope you understand what I mean :(

- Original Message - 
From: "Vidya (Suvarna) Mahavadi" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Thursday, January 26, 2006 5:16 PM
Subject: RE: struts html:checkbox value


I did. But it does not help.

I have a form with a huge list of data (which I am displaying in pages,
10 per page) and a save button which saves the data (on the current
page) and reloads the page. When it submits the form it is ignoring the
disabled check boxes (always submits as false), it should actually
submit the Boolean properties of them. Any ideas on this please...


Vidya

-Original Message-
From: Pham Anh Tuan [mailto:[EMAIL PROTECTED]
Sent: Thursday 26 January 2006 11:53
To: Struts Users Mailing List
Subject: Re: struts html:checkbox value

Dear Vidya,

there's a solution, in reset method of your form bean, you should set
all
your checkbox to false. ;)

- Original Message - 
From: "Vidya (Suvarna) Mahavadi" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Thursday, January 26, 2006 4:37 PM
Subject: struts html:checkbox value




Hi ,



If a check box is disabled and checked does it submit the value true? I
have a situation where it is not submitting the disabled checkbox
properties. Is there a work around for this...



Regards,
Vidya


This message and any attachments are confidential and intended solely
for
the addressee. If you have received this message in error, please notify

Discovery immediately, telephone number +27 11 529 2888. Any
unauthorised
use; alteration or dissemination of the contents of this email is
strictly
prohibited. In no event will Discovery or the sender be liable in any
manner
whatsoever to any person for any loss or any direct, indirect, special
or
consequential damages arising from use of this email or any linked
website,
including, without limitation, from any lost profits, business
interruption,
loss of programmes or other data that may be stored on any information
handling system or otherwise from any assurance that this email is virus

free even if Discovery is expressly advised of the possibility of such
damages. Discovery is an Authorised Financial Services Provider.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

This message and any attachments are confidential and intended solely for 
the addressee. If you have received this message in error, please notify 
Discovery immediately, telephone number +27 11 529 2888. Any unauthorised 
use; alteration or dissemination of the contents of this email is strictly 
prohibited. In no event will Discovery or the sender be liable in any manner 
whatsoever to any person for any loss or any direct, indirect, special or 
consequential damages arising from use of this email or any linked website, 
including, without limitation, from any lost profits, business interruption, 
loss of programmes or other data that may be stored on any information 
handling system or otherwise from any assurance that this email is virus 
free even if Discovery is expressly advised of the possibility of such 
damages. Discovery is an Authorised Financial Services Provider.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: struts html:checkbox value

2006-01-26 Thread Niall Pemberton
On 1/26/06, Vidya (Suvarna) Mahavadi <[EMAIL PROTECTED]> wrote:
>
> Hi ,
>
> If a check box is disabled and checked does it submit the value true? I
> have a situation where it is not submitting the disabled checkbox
> properties. Is there a work around for this...

This is a browser / HTTP isssue - disabled fields don't get submitted.

Niall

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: struts html:checkbox value

2006-01-26 Thread Vidya \(Suvarna\) Mahavadi
I did. But it does not help. 

I have a form with a huge list of data (which I am displaying in pages,
10 per page) and a save button which saves the data (on the current
page) and reloads the page. When it submits the form it is ignoring the
disabled check boxes (always submits as false), it should actually
submit the Boolean properties of them. Any ideas on this please...


Vidya

-Original Message-
From: Pham Anh Tuan [mailto:[EMAIL PROTECTED] 
Sent: Thursday 26 January 2006 11:53
To: Struts Users Mailing List
Subject: Re: struts html:checkbox value

Dear Vidya,

there's a solution, in reset method of your form bean, you should set
all 
your checkbox to false. ;)

- Original Message - 
From: "Vidya (Suvarna) Mahavadi" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" 
Sent: Thursday, January 26, 2006 4:37 PM
Subject: struts html:checkbox value




Hi ,



If a check box is disabled and checked does it submit the value true? I
have a situation where it is not submitting the disabled checkbox
properties. Is there a work around for this...



Regards,
Vidya


This message and any attachments are confidential and intended solely
for 
the addressee. If you have received this message in error, please notify

Discovery immediately, telephone number +27 11 529 2888. Any
unauthorised 
use; alteration or dissemination of the contents of this email is
strictly 
prohibited. In no event will Discovery or the sender be liable in any
manner 
whatsoever to any person for any loss or any direct, indirect, special
or 
consequential damages arising from use of this email or any linked
website, 
including, without limitation, from any lost profits, business
interruption, 
loss of programmes or other data that may be stored on any information 
handling system or otherwise from any assurance that this email is virus

free even if Discovery is expressly advised of the possibility of such 
damages. Discovery is an Authorised Financial Services Provider.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

This message and any attachments are confidential and intended solely for the 
addressee. If you have received this message in error, please notify Discovery 
immediately, telephone number +27 11 529 2888. Any unauthorised use; alteration 
or dissemination of the contents of this email is strictly prohibited. In no 
event will Discovery or the sender be liable in any manner whatsoever to any 
person for any loss or any direct, indirect, special or consequential damages 
arising from use of this email or any linked website, including, without 
limitation, from any lost profits, business interruption, loss of programmes or 
other data that may be stored on any information handling system or otherwise 
from any assurance that this email is virus free even if Discovery is expressly 
advised of the possibility of such damages. Discovery is an Authorised 
Financial Services Provider.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: struts html:checkbox value

2006-01-26 Thread Pham Anh Tuan

Dear Vidya,

there's a solution, in reset method of your form bean, you should set all 
your checkbox to false. ;)


- Original Message - 
From: "Vidya (Suvarna) Mahavadi" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Thursday, January 26, 2006 4:37 PM
Subject: struts html:checkbox value




Hi ,



If a check box is disabled and checked does it submit the value true? I
have a situation where it is not submitting the disabled checkbox
properties. Is there a work around for this...



Regards,
Vidya


This message and any attachments are confidential and intended solely for 
the addressee. If you have received this message in error, please notify 
Discovery immediately, telephone number +27 11 529 2888. Any unauthorised 
use; alteration or dissemination of the contents of this email is strictly 
prohibited. In no event will Discovery or the sender be liable in any manner 
whatsoever to any person for any loss or any direct, indirect, special or 
consequential damages arising from use of this email or any linked website, 
including, without limitation, from any lost profits, business interruption, 
loss of programmes or other data that may be stored on any information 
handling system or otherwise from any assurance that this email is virus 
free even if Discovery is expressly advised of the possibility of such 
damages. Discovery is an Authorised Financial Services Provider.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



struts html:checkbox value

2006-01-26 Thread Vidya \(Suvarna\) Mahavadi
 

Hi , 

 

If a check box is disabled and checked does it submit the value true? I
have a situation where it is not submitting the disabled checkbox
properties. Is there a work around for this... 

 

Regards,
Vidya


This message and any attachments are confidential and intended solely for the 
addressee. If you have received this message in error, please notify Discovery 
immediately, telephone number +27 11 529 2888. Any unauthorised use; alteration 
or dissemination of the contents of this email is strictly prohibited. In no 
event will Discovery or the sender be liable in any manner whatsoever to any 
person for any loss or any direct, indirect, special or consequential damages 
arising from use of this email or any linked website, including, without 
limitation, from any lost profits, business interruption, loss of programmes or 
other data that may be stored on any information handling system or otherwise 
from any assurance that this email is virus free even if Discovery is expressly 
advised of the possibility of such damages. Discovery is an Authorised 
Financial Services Provider.


html:checkbox

2005-11-04 Thread Ray Madigan
Greetings,

I remember getting something like this to work in the past, I have searched
and cannot find what is missing, or what I'm doing wrong, or if it is even
possible.

I want to connect a set of checkboxes to a HashMap in my action form.

In my ActionForm I have a two methods like

public void setValue ( String key, boolean value );
public boolean getValue ( String key );

in the form reset method I clear the HashMap.

For the Action Class method of the class I initialize the hashmap like:

theForm.setValue ( "Foo", false );
theForm.setValue ( "Bar", true );

In my JSP i have tried many things like


...



...


When I do this I get a an exception
no getter method for property 'value("Foo")' of bean
org.apache.struts.taglib.html.BEAN

I have tried many alternatives, too many to post here.  Is this supposed to
work?

Thanks in advance


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



html:checkbox or html:multibox- question in implementation

2005-01-21 Thread Rosemary Philip
Hi,

I have a jsp which shows a drop down combobox, a text box and submit
cancel buttons.
the drop down combo box is a collection of objects. to be exact an
arraylist which is placed in session in the action class.

The object is a technique object which has the following attributes:
techCd : type String : primary key 
techDscr : type String : a description of the technique
actCd : type String : can be A indicating Active and D indicating Deleted

--Earlier only these where present




 
 







Earlier the value can be selected and updated. select an old technique
and enter the new description in the textbox.

But now I need to place a checkbox alongside the drop down combo box ,
so that the checkbox gets checked when the selection in the combobox
changes.

I read everything I could on how to implement this, and I think I need
to do this via html:multibox
--Now trying to implement checkboxes-



 








  



the above code gives me a 
[ServletException in:/tiles/modifytile.jsp] Cannot create iterator for
this collection'

I have the following code in my ModifyForm


code:


 private String techUsed;
private String[] selected;
public String[] getSelected() 
{   
return selected;
}   
public void setSelected(String[] newSelected) 
{   
selected = newSelected; 
}   
public String getTechUsed() 
{   
return techUsed;
}   
public void setTechUsed(String str)
 {  
this.techUsed = str;
} 



Could anyone give any suggestions/help on what am I doing wrong,
please? Is it possible to check/uncheck a checkbox/multibox based on
the selected value in the dropdown combo box?

I think it will be simpler to write them as a list using 
and place checkboxes along side for each as indicated in this article

http://www.onjava.com/pub/a/onjava/2003/07/30/jakartastruts.html?page=last

But when there are too many values , the page can be too long.

If I use a single select list , the display will be better and users
can easily navigate to a value , but we should only have a single
checkbox and the problem becomes similar to that I am facing now.

single select list code sample
http://javaboutique.internet.com/tutorials/strutsform/index-4.html

Please help out. my only other option is scriplets.   :(
Thanks,
Rosemary

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



FW: Struts html:checkbox

2004-11-05 Thread Robert Taylor
-Original Message-
From: Jean-Philippe Couture [mailto:[EMAIL PROTECTED]
Sent: Friday, November 05, 2004 2:25 PM
To: Robert Taylor
Subject: Re: Struts html:checkbox


Hi Robert,

Thanks a bunch for the helpful tip. I used a 
((DynaActionForm)form).set("propName",String.valueOf(boolValue));
in the Action class right before loading the JSP.

It works exactly as expected now. Thanks again!

Best regards,

Jean-Philippe Couture

On Fri, 5 Nov 2004 12:11:12 -0500, Robert Taylor <[EMAIL PROTECTED]> wrote:
> Set the corresponding form property to true prior to loading the page.
> If the actual form property value equals the ${boolValue}, then the
> checkbox should render as checked. That is, it should produce the
> appropriate HTML which should render the checkbox as checked.
> 
> robert
> 
> 
> 
> > -Original Message-
> > From: Jean-Philippe Couture [mailto:[EMAIL PROTECTED]
> > Sent: Friday, November 05, 2004 11:56 AM
> > To: [EMAIL PROTECTED]
> > Subject: Struts html:checkbox
> >
> >
> > Hi,
> >
> > Sorry if this problem has already been solved, I cannot seem to find
> > anything in the Struts List Archive...
> >
> > I have an Action class that sets, in the ActionForward method of the
> > said Action class, an attribute of an object in the request scope to
> > push it to the presentation layer (JSP). In the JSP form, I use
> > exclusively Custom Struts Tag to display data from the object in the
> > request scope.
> >
> > Everything works greatly except for that
> >  > value="${boolValue}"> which doesn't seem to render the
> > "checked="checked" attribute. The value of the "value" attribute is
> > set to true... but for some reason, I can't seem to get it render
> > checked on load.
> >
> > Is there a way to get a  render as checked upon JSP load?
> >
> >
> > Best regards,
> > 
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Struts html:checkbox

2004-11-05 Thread Robert Taylor
Set the corresponding form property to true prior to loading the page.
If the actual form property value equals the ${boolValue}, then the 
checkbox should render as checked. That is, it should produce the 
appropriate HTML which should render the checkbox as checked.

robert

> -Original Message-
> From: Jean-Philippe Couture [mailto:[EMAIL PROTECTED]
> Sent: Friday, November 05, 2004 11:56 AM
> To: [EMAIL PROTECTED]
> Subject: Struts html:checkbox
> 
> 
> Hi,
> 
> Sorry if this problem has already been solved, I cannot seem to find
> anything in the Struts List Archive...
> 
> I have an Action class that sets, in the ActionForward method of the
> said Action class, an attribute of an object in the request scope to
> push it to the presentation layer (JSP). In the JSP form, I use
> exclusively Custom Struts Tag to display data from the object in the
> request scope.
> 
> Everything works greatly except for that
>  value="${boolValue}"> which doesn't seem to render the
> "checked="checked" attribute. The value of the "value" attribute is
> set to true... but for some reason, I can't seem to get it render
> checked on load.
> 
> Is there a way to get a  render as checked upon JSP load?
> 
> 
> Best regards,
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Struts html:checkbox

2004-11-05 Thread Jean-Philippe Couture
Hi,

Sorry if this problem has already been solved, I cannot seem to find
anything in the Struts List Archive...

I have an Action class that sets, in the ActionForward method of the
said Action class, an attribute of an object in the request scope to
push it to the presentation layer (JSP). In the JSP form, I use
exclusively Custom Struts Tag to display data from the object in the
request scope.

Everything works greatly except for that
 which doesn't seem to render the
"checked="checked" attribute. The value of the "value" attribute is
set to true... but for some reason, I can't seem to get it render
checked on load.

Is there a way to get a  render as checked upon JSP load?


Best regards,

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: html:checkbox default value

2004-09-12 Thread Rick Reumann
Erez Efrati wrote the following on 9/12/2004 7:03 AM:
If I put it in the form bean constructor wouldn't it cause the field
value to be always "true" no matter if the user unchecks it and submit
the form.  As far as I can recall a checkbox field should be reset to
false before the form population.
I believe you would be correct in that if you do set a boolean checkbox 
property to true in your formBean (either in constructor or by 
declaration), you will end up with it remaining true if the user 
'unchecks' the box on the form. This is because http does not send over 
the checkbox property if is not checked.

This is why I use a setUp method in my Action (like Craig mentioned) and 
usually I also make sure my boolean properties are reset to false in the 
reset method of my ActionForm. In the setUp method you could set up your 
initial ActionForm boolean property to be whatever you wanted (if it's 
false by default you wouldn't need to do this, but you would still want 
to make sure you used the reset method to set your boolean back to false 
if you plan on using Struts form validation).

--
Rick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: html:checkbox default value

2004-09-12 Thread Erez Efrati
If I put it in the form bean constructor wouldn't it cause the field
value to be always "true" no matter if the user unchecks it and submit
the form. As far as I can recall a checkbox field should be reset to
false before the form population.

Erez

-Original Message-
From: Craig McClanahan [mailto:[EMAIL PROTECTED] 
Sent: Sunday, September 12, 2004 1:38 AM
To: Struts Users Mailing List
Subject: Re: html:checkbox default value

The values displayed on the page are copied from the form bean, so the
right answer is to set the value of the "schedule" property in your
form bean to true.  This can be done in the form bean constructor (if
you want this initial value all the time), or -- more typical for an
update scenario -- you can execute a "setup" action that pre-fills the
form bean (perhaps from information loaded from a database) before
forwarding to the page.

Craig


On Sat, 11 Sep 2004 21:53:36 +0200, Erez Efrati <[EMAIL PROTECTED]>
wrote:
> I am trying to set the default value of a checkbox to 'checked' by
> putting:
> 
> 
> but somehow it does not check it. The produced HTML gives me
> 
> 
> 
> What am I missing here?
> 
> Thanks,
> 
> Erez
> 
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: html:checkbox default value

2004-09-11 Thread Craig McClanahan
The values displayed on the page are copied from the form bean, so the
right answer is to set the value of the "schedule" property in your
form bean to true.  This can be done in the form bean constructor (if
you want this initial value all the time), or -- more typical for an
update scenario -- you can execute a "setup" action that pre-fills the
form bean (perhaps from information loaded from a database) before
forwarding to the page.

Craig


On Sat, 11 Sep 2004 21:53:36 +0200, Erez Efrati <[EMAIL PROTECTED]> wrote:
> I am trying to set the default value of a checkbox to 'checked' by
> putting:
> 
> 
> but somehow it does not check it. The produced HTML gives me
> 
> 
> 
> What am I missing here?
> 
> Thanks,
> 
> Erez
> 
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: html:checkbox default value

2004-09-11 Thread Erez Efrati
Looking in the code, the tag does not provide any way to set/force the
default value - only by setting the value on the form bean.

A small workaround is to do:



Which works. Still the better way is to work with the form and so anyone

Who reads this don't get the idea that I am aiming at this way but still
it is sometime useful. Not always we have an init action which is
especially a pain with a form that belongs to some tile.

Erez



-Original Message-
From: Erez Efrati [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 11, 2004 9:54 PM
To: 'Struts Users Mailing List'
Subject: html:checkbox default value

I am trying to set the default value of a checkbox to 'checked' by
putting:

 
but somehow it does not check it. The produced HTML gives me 
 
 
 
What am I missing here?
 
Thanks,
 
Erez
 
 
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



html:checkbox default value

2004-09-11 Thread Erez Efrati
I am trying to set the default value of a checkbox to 'checked' by
putting:

 
but somehow it does not check it. The produced HTML gives me 
 
 
 
What am I missing here?
 
Thanks,
 
Erez
 
 
 


Re: html:checkbox no getter method for propety

2004-08-25 Thread Wendy Smoak
From: "Ricardo Andres Quintero"
> Hello im getting an error that
> i have a bean form with a boolean property
> but when i use ,
> i got a no getter method for propert myProp,
> but it does exist in the bean form.
> any ideas?

Post your code, otherwise we're just guessing.  You've got 'checbox' not
'checkbox' in your snippet above, so I'll assume that was retyped and not
pasted in.

Check that your form bean conforms to JavaBeans naming specifications-- 
get/setMyProp (or isMyProp if you prefer, but it should work either way.)
Make sure you don't have multiple 'setMyProp' methods with different types.

-- 
Wendy Smoak


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: html:checkbox no getter method for propety

2004-08-25 Thread Jim Barrows


> -Original Message-
> From: Ricardo Andres Quintero [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 25, 2004 3:04 PM
> To: Struts Users Mailing List
> Subject: RE: html:checkbox no getter method for propety
> 
> 
> Mensaje citado por Jim Barrows <[EMAIL PROTECTED]>:
> 
> > 
> > 
> > > -Original Message-
> > > From: Ricardo Andres Quintero [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, August 25, 2004 2:42 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: html:checkbox no getter method for propety
> > > 
> > > 
> > > 
> > > Hello im getting an error that
> > > i have a bean form with a boolean property
> > > but when i use ,
> > > i got a no getter method for propert myProp,
> > > but it does exist in the bean form.
> > > 
> > > any ideas?
> > 
> > Start with the obvious
> > getter for boolean value is not a getBoolean(), it's isBoolean();
> 
> I have already tried with isBoolean()...

Well so much for the easy one
Okay so you have:
public class MyForm extends blahForm {
private boolean myProperty;
public void setMyProperty( booelan value) {
myProperty=value;
}
public boolean isMyProperty() {
return myPoperty;
}
}

in the jsp:



and you're getting a no property. I'm thinking that the form the 

RE: html:checkbox no getter method for propety

2004-08-25 Thread Ricardo Andres Quintero
Mensaje citado por Jim Barrows <[EMAIL PROTECTED]>:

> 
> 
> > -Original Message-
> > From: Ricardo Andres Quintero [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, August 25, 2004 2:42 PM
> > To: [EMAIL PROTECTED]
> > Subject: html:checkbox no getter method for propety
> > 
> > 
> > 
> > Hello im getting an error that
> > i have a bean form with a boolean property
> > but when i use ,
> > i got a no getter method for propert myProp,
> > but it does exist in the bean form.
> > 
> > any ideas?
> 
> Start with the obvious
> getter for boolean value is not a getBoolean(), it's isBoolean();
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


I have already tried with isBoolean()...

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: html:checkbox no getter method for propety

2004-08-25 Thread Jim Barrows


> -Original Message-
> From: Ricardo Andres Quintero [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 25, 2004 2:42 PM
> To: [EMAIL PROTECTED]
> Subject: html:checkbox no getter method for propety
> 
> 
> 
> Hello im getting an error that
> i have a bean form with a boolean property
> but when i use ,
> i got a no getter method for propert myProp,
> but it does exist in the bean form.
> 
> any ideas?

Start with the obvious
getter for boolean value is not a getBoolean(), it's isBoolean();

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



html:checkbox no getter method for propety

2004-08-25 Thread Ricardo Andres Quintero

Hello im getting an error that
i have a bean form with a boolean property
but when i use ,
i got a no getter method for propert myProp,
but it does exist in the bean form.

any ideas?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Default html:checkbox to true

2004-08-23 Thread Ellingson, David
That seems to be the cleanest way to handle it.  Thanks.

Dave

-Original Message-
From: news [mailto:[EMAIL PROTECTED] Behalf Of Lionel
Sent: Monday, August 23, 2004 9:42 AM
To: [EMAIL PROTECTED]
Subject: Re: Default html:checkbox to true


Ellingson, David wrote:
> It seems like this question would have been asked before, but I
> couldn't find an answer in the archives.  I am able to successfully
> use the html:checkbox tag.  However, this tag seems to be trickier to
> use when you want to default the box to "checked".  Simply setting
> the form attribute to true won't work, since an unchecked value will
> not be submitted and the form attribute will remain true.

why don't you validate the value sent by the chekbox in the validate method
?
Set your form attribute to false if no parameter is sent by your form.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Default html:checkbox to true

2004-08-23 Thread Ellingson, David
However, it seems that results in the checkboxes defaulting to unchecked
when the page is displayed; I need the checkboxes defaulted to "checked".

Thanks,
Dave

-Original Message-
From: Rick Reumann [mailto:[EMAIL PROTECTED]
Sent: Monday, August 23, 2004 10:25 AM
To: Struts Users Mailing List
Subject: Re: Default html:checkbox to true


Ellingson, David wrote:

> It seems like this question would have been asked before, but I couldn't
> find an answer in the archives.  I am able to successfully use the
> html:checkbox tag.  However, this tag seems to be trickier to use when you
> want to default the box to "checked".  Simply setting the form attribute
to
> true won't work, since an unchecked value will not be submitted and the
form
> attribute will remain true.  

You are having trouble because you need to use the reset() method to set 
all your checkboxes to false. Then, after your form submits only the 
ones checked will be set to true and everything will be fine (remember 
Struts always calls the reset method first then it populates your 
ActionForm with the submitted params). You do not need to do all those 
javascript hacks.

-- 
Rick

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Default html:checkbox to true

2004-08-23 Thread Rick Reumann
Ellingson, David wrote:
It seems like this question would have been asked before, but I couldn't
find an answer in the archives.  I am able to successfully use the
html:checkbox tag.  However, this tag seems to be trickier to use when you
want to default the box to "checked".  Simply setting the form attribute to
true won't work, since an unchecked value will not be submitted and the form
attribute will remain true.  
You are having trouble because you need to use the reset() method to set 
all your checkboxes to false. Then, after your form submits only the 
ones checked will be set to true and everything will be fine (remember 
Struts always calls the reset method first then it populates your 
ActionForm with the submitted params). You do not need to do all those 
javascript hacks.

--
Rick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Default html:checkbox to true

2004-08-23 Thread Lionel
Ellingson, David wrote:
> It seems like this question would have been asked before, but I
> couldn't find an answer in the archives.  I am able to successfully
> use the html:checkbox tag.  However, this tag seems to be trickier to
> use when you want to default the box to "checked".  Simply setting
> the form attribute to true won't work, since an unchecked value will
> not be submitted and the form attribute will remain true.

why don't you validate the value sent by the chekbox in the validate method
?
Set your form attribute to false if no parameter is sent by your form.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Default html:checkbox to true

2004-08-23 Thread Ellingson, David
It seems like this question would have been asked before, but I couldn't
find an answer in the archives.  I am able to successfully use the
html:checkbox tag.  However, this tag seems to be trickier to use when you
want to default the box to "checked".  Simply setting the form attribute to
true won't work, since an unchecked value will not be submitted and the form
attribute will remain true.  I've actually got this to work by what seems to
be a hack.  To force the browser to send a value when the box is unchecked,
I used the following Javascript:

if (document.getElementById("flag").checked == false) {
// Force the browser to send a value
document.getElementById("flag").checked = true;
// Set the value to false
document.getElementById("flag").value="false";
} 

This actually works fine, although the checkbox is toggled briefly to
"checked" before the form is submitted.  Is there a better to way to handle
checkboxes that need to default to "checked"?

Thanks,
Dave

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Can html:checkbox take only yes/true/on as value?

2004-07-13 Thread Shilpa Vaidya


Hi prashant

One of my edit pages faced this kinda stufff...

 checked  <%}
else{%> <%}%> value="Y">
  value="Y" <%}
else{%> value=""<%}%>


perhaps this will work as it encloses the check box ...its prepoulated
value...at the same time...a hidden field which sets the new value...incase
we click the checkbox in the edit section.
Shilpa



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 13, 2004 2:14 AM
To: [EMAIL PROTECTED]
Subject: Can html:checkbox take only yes/true/on as value?


Hi,



In regular HTML checkbox, the value of the checkbox can practically be
anything. Does the struts html:checkbox limit us to just yes/true/on
values?

If I have a list of records that I get from the database and I want to
display it with a checkbox at the left, the value of the checkbox being
the id of the record, how do I do that? Should there be another hidden
field for the checkbox with the actual value? And how do I connect the
checkbox to its corresponding hidden field?



I have searched high and low and found no clear explanation. I just want
someone to explain this to me.



Also how does the multibox fall into the picture? Can I use checkbox and
multibox interchangeably?

Thanks

Prashanthi



-- 


"This e-mail message may contain confidential, proprietary or legally privileged 
information. It 
should not be used by anyone who is not the original intended recipient. If you have 
erroneously 
received this message, please delete it immediately and notify the sender. The 
recipient 
acknowledges that ICICI Bank or its subsidiaries and associated companies,  
(collectively "ICICI 
Group"), are unable to exercise control or ensure or guarantee the integrity of/over 
the contents of the information contained in e-mail transmissions and further 
acknowledges that any views 
expressed in this message are those of the individual sender and no binding nature of 
the message shall be implied or assumed unless the sender does so expressly with due 
authority of ICICI Group.Before opening any attachments please check them for viruses 
and defects." 




Re: Can html:checkbox take only yes/true/on as value?

2004-07-13 Thread Wendy Smoak
From: <[EMAIL PROTECTED]>
> In regular HTML checkbox, the value of the checkbox can practically be
> anything. Does the struts html:checkbox limit us to just yes/true/on
> values?

No, you can have anything you want as the value.  It might default to yes or
true, I haven't tried it.

> If I have a list of records that I get from the database and I want to
> display it with a checkbox at the left, the value of the checkbox being
> the id of the record, how do I do that?

Use the 'value' attribute of the  tag, then if the box is
checked, that value will be submitted as the value of the form element.

(Checkboxes are special-- only successful/checked ones will be submitted, so
read the docs and reset them properly or you'll never be able to UNcheck
them.)

> Also how does the multibox fall into the picture? Can I use checkbox and
> multibox interchangeably?

No... checkbox is a single thing, and corresponds to a String property in
your Form bean.  Multibox corresponds to a String[], because you can choose
more than one item.  Here's an example of multibox:


   
 



Technically, I suppose you could use multibox in place of checkbox, but if
you're expecting multiple values, checkbox won't work, you'll only ever see
the final value that the browser submitted.

HTH,
-- 
Wendy Smoak


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Can html:checkbox take only yes/true/on as value?

2004-07-13 Thread Jim Barrows


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 12, 2004 1:44 PM
> To: [EMAIL PROTECTED]
> Subject: Can html:checkbox take only yes/true/on as value?



> I have searched high and low and found no clear explanation. 

Try husted.com/struts for really cool tips and tricks :)

> I just want 
> someone to explain this to me. 

http://husted.com/struts/tips/007.html

> 
>  
> 
> Also how does the multibox fall into the picture? Can I use 
> checkbox and 
> multibox interchangeably? 

I suppose but why?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Can html:checkbox take only yes/true/on as value?

2004-07-13 Thread Prashanthi . Pokala
Hi, 

 

In regular HTML checkbox, the value of the checkbox can practically be 
anything. Does the struts html:checkbox limit us to just yes/true/on 
values? 

If I have a list of records that I get from the database and I want to 
display it with a checkbox at the left, the value of the checkbox being 
the id of the record, how do I do that? Should there be another hidden 
field for the checkbox with the actual value? And how do I connect the 
checkbox to its corresponding hidden field? 

 

I have searched high and low and found no clear explanation. I just want 
someone to explain this to me. 

 

Also how does the multibox fall into the picture? Can I use checkbox and 
multibox interchangeably? 

Thanks

Prashanthi


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]