Re: Checkbox problem?

2003-06-10 Thread James Mitchell
Can you describe what's going on in more detail?

--
James Mitchell
Software Developer/Struts Evangelist
http://www.struts-atlanta.org


- Original Message -
From: "Bjorn T Johansen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 10, 2003 4:26 AM
Subject: Checkbox problem?


> I use checkboxes to input some variables in a form and as long as I
> insert new records, i.e. the checkbox variable gets set to false in the
> form's reset method, it works fine.
> But when I, say, edit the same record (and propagate the values of the
> form in the reset method), I never can uncheck the checkbox if it was
> set to true in the reset method.
>
> Are there any solutions/work around for this?
>
>
> Regards,
>
> BTJ
>
>
>
> --
-
> Bjørn T Johansen (BSc,MNIF)
> Executive Manager
> [EMAIL PROTECTED]  Havleik Consulting
> Phone : +47 67 54 15 17 Conradisvei 4
> Fax : +47 67 54 13 91   N-1338 Sandvika
> Cellular : +47 926 93 298   http://www.havleik.no
> --
-
> "The stickers on the side of the box said "Supported Platforms: Windows
> 98, Windows NT 4.0,
> Windows 2000 or better", so clearly Linux was a supported platform."
> --
-
>
>
> -
> 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: Checkbox problem?

2003-06-10 Thread Kandi Potter
I would suggest not doing the propagate in the reset.   Just use it for the original 
values.   The values entered on the form are automatically propagated by struts after 
the reset by the setters and getters.   Just put in some logging or print statements 
in those methods and you will see when they are invoked.

-Original Message-
From: Bjorn T Johansen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 4:27 AM
To: [EMAIL PROTECTED]
Subject: Checkbox problem?


I use checkboxes to input some variables in a form and as long as I
insert new records, i.e. the checkbox variable gets set to false in the
form's reset method, it works fine.
But when I, say, edit the same record (and propagate the values of the
form in the reset method), I never can uncheck the checkbox if it was
set to true in the reset method.

Are there any solutions/work around for this?


Regards,

BTJ



---
Bjørn T Johansen (BSc,MNIF)
Executive Manager
[EMAIL PROTECTED]  Havleik Consulting
Phone : +47 67 54 15 17 Conradisvei 4
Fax : +47 67 54 13 91   N-1338 Sandvika
Cellular : +47 926 93 298   http://www.havleik.no
---
"The stickers on the side of the box said "Supported Platforms: Windows
98, Windows NT 4.0,
Windows 2000 or better", so clearly Linux was a supported platform."
---


-
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: Checkbox problem?

2003-06-10 Thread Kamholz, Keith (corp-staff) USX
I had some issues with the methods, so I came up with something else that
works very nicely.

In the JSP, right after the code for the checkbox, use:


This allows the form submission to work correctly, without any messy code.
However, I am no expert with this stuff, so if there is any reason not to do
this I'd be interested in hearing it.


Keith Kamholz
Programming and Architecture
Moog Inc.

Phone: (716) 687-7001



-Original Message-
From: Bjorn T Johansen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 4:27 AM
To: [EMAIL PROTECTED]
Subject: Checkbox problem?


I use checkboxes to input some variables in a form and as long as I
insert new records, i.e. the checkbox variable gets set to false in the
form's reset method, it works fine.
But when I, say, edit the same record (and propagate the values of the
form in the reset method), I never can uncheck the checkbox if it was
set to true in the reset method.

Are there any solutions/work around for this?


Regards,

BTJ




---
Bjørn T Johansen (BSc,MNIF)
Executive Manager
[EMAIL PROTECTED]  Havleik Consulting
Phone : +47 67 54 15 17 Conradisvei 4
Fax : +47 67 54 13 91   N-1338 Sandvika
Cellular : +47 926 93 298   http://www.havleik.no

---
"The stickers on the side of the box said "Supported Platforms: Windows
98, Windows NT 4.0,
Windows 2000 or better", so clearly Linux was a supported platform."

---


-
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: Checkbox problem?

2003-06-10 Thread Bjørn T Johansen
Yes, but to clarify...
I am showing a jsp page with values read from a database. If the
checkbox value is true, how do I then make the checkbox on my jsp-page
checked and how do I then find out if the checkbox has been unchecked?
Do I have to manually read the posted data and see if the checkbox
attribute is missing or is there a better way?


BTJ

On Tue, 2003-06-10 at 15:45, Kandi Potter wrote:
> I would suggest not doing the propagate in the reset.   Just use it for the original 
> values.   The values entered on the form are automatically propagated by struts 
> after the reset by the setters and getters.   Just put in some logging or print 
> statements in those methods and you will see when they are invoked.
> 
> -Original Message-
> From: Bjorn T Johansen [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 10, 2003 4:27 AM
> To: [EMAIL PROTECTED]
> Subject: Checkbox problem?
> 
> 
> I use checkboxes to input some variables in a form and as long as I
> insert new records, i.e. the checkbox variable gets set to false in the
> form's reset method, it works fine.
> But when I, say, edit the same record (and propagate the values of the
> form in the reset method), I never can uncheck the checkbox if it was
> set to true in the reset method.
> 
> Are there any solutions/work around for this?
> 
> 
> Regards,
> 
> BTJ
> 
> 
> 
> ---
> Bjørn T Johansen (BSc,MNIF)
> Executive Manager
> [EMAIL PROTECTED]  Havleik Consulting
> Phone : +47 67 54 15 17 Conradisvei 4
> Fax : +47 67 54 13 91   N-1338 Sandvika
> Cellular : +47 926 93 298   http://www.havleik.no
> ---
> "The stickers on the side of the box said "Supported Platforms: Windows
> 98, Windows NT 4.0,
> Windows 2000 or better", so clearly Linux was a supported platform."
> ---
> 
> 
> -
> 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]
-- 
---
Bjørn T Johansen (BSc,MNIF)
Executive Manager
[EMAIL PROTECTED]  Havleik Consulting
Phone : +47 67 54 15 17 Conradisvei 4
Fax : +47 67 54 13 91   N-1338 Sandvika
Cellular : +47 926 93 298   http://www.havleik.no
---
"The stickers on the side of the box said "Supported Platforms: Windows
98, Windows NT 4.0,
Windows 2000 or better", so clearly Linux was a supported platform."
---


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



RE: Checkbox problem?

2003-06-10 Thread Kevin Robair
In your ActionForm reset() method, set the checkbox
value to false.

Struts will set the value to true if the box is
checked.

If you are using DynaForms, you will need to extend it
and override the reset() method.

To populate the checkbox initially, you need to
instantiate and populate the form bean and place it in
the appropraite context. For more details, see:

http://jakarta.apache.org/struts/faqs/newbie.html#prepopulate
http://jakarta.apache.org/struts/faqs/newbie.html#checkbox

-Kevin

--- Bjørn T Johansen <[EMAIL PROTECTED]> wrote:
> Yes, but to clarify...
> I am showing a jsp page with values read from a
> database. If the
> checkbox value is true, how do I then make the
> checkbox on my jsp-page
> checked and how do I then find out if the checkbox
> has been unchecked?
> Do I have to manually read the posted data and see
> if the checkbox
> attribute is missing or is there a better way?
> 
> 
> BTJ
> 
> On Tue, 2003-06-10 at 15:45, Kandi Potter wrote:
> > I would suggest not doing the propagate in the
> reset.   Just use it for the original values.   The
> values entered on the form are automatically
> propagated by struts after the reset by the setters
> and getters.   Just put in some logging or print
> statements in those methods and you will see when
> they are invoked.
> > 
> > -Original Message-
> > From: Bjorn T Johansen [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, June 10, 2003 4:27 AM
> > To: [EMAIL PROTECTED]
> > Subject: Checkbox problem?
> > 
> > 
> > I use checkboxes to input some variables in a form
> and as long as I
> > insert new records, i.e. the checkbox variable
> gets set to false in the
> > form's reset method, it works fine.
> > But when I, say, edit the same record (and
> propagate the values of the
> > form in the reset method), I never can uncheck the
> checkbox if it was
> > set to true in the reset method.
> > 
> > Are there any solutions/work around for this?
> > 
> > 
> > Regards,
> > 
> > BTJ
> > 
> > 
> > 
> >
>
---
> > Bjørn T Johansen (BSc,MNIF)
> > Executive Manager
> > [EMAIL PROTECTED]  Havleik Consulting
> > Phone : +47 67 54 15 17 Conradisvei 4
> > Fax : +47 67 54 13 91   N-1338 Sandvika
> > Cellular : +47 926 93 298  
> http://www.havleik.no
> >
>
---
> > "The stickers on the side of the box said
> "Supported Platforms: Windows
> > 98, Windows NT 4.0,
> > Windows 2000 or better", so clearly Linux was a
> supported platform."
> >
>
---
> > 
> > 
> >
>
-
> > 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]
> -- 
>
---
> Bjørn T Johansen (BSc,MNIF)
> Executive Manager
> [EMAIL PROTECTED]  Havleik Consulting
> Phone : +47 67 54 15 17 Conradisvei 4
> Fax : +47 67 54 13 91   N-1338 Sandvika
> Cellular : +47 926 93 298  
> http://www.havleik.no
>
---
> "The stickers on the side of the box said "Supported
> Platforms: Windows
> 98, Windows NT 4.0,
> Windows 2000 or better", so clearly Linux was a
> supported platform."
>
---
> 
> 
>
-
> 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: Checkbox problem?

2003-06-10 Thread Tor Henrik Hanken
[EMAIL PROTECTED]

| Yes, but to clarify...
| I am showing a jsp page with values read from a database. If the
| checkbox value is true, how do I then make the checkbox on my jsp-page
| checked and how do I then find out if the checkbox has been unchecked?
| Do I have to manually read the posted data and see if the checkbox
| attribute is missing or is there a better way?

I assume that you are using an Action with an ActionForm.

To make the value of the checkbox come up correctly, import
struts tags into your jsp-page: 

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="strb" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="strh" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="strl" %>

Then use the Struts checkbox tag:



Assuming that your form has the methods getDone and setDone,
these methods will be used to render the value of the checkbox
correctly.

As to the question of boolean values that are set to false by the
user: You don't have to parse the posted data manually.  The
method reset() in ActionForm is run before the posted data is
used to populate the form.  Write your own reset() method where
you set the boolean fields to false.

-- 
mvh

Tor Henrik Hanken

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



Re: Checkbox problem?

2003-06-10 Thread Bjørn T Johansen
You are missing my point! If I just could set the checkbox value to
false in the reset method, everything is fine. But there are times when
that value has to be reset to true and not false and if I do that in my
reset method, I am not able to see of the user unchek the checkbox,
because the boolean variable is still true after the form has been
posted!


BTJ

On Tue, 2003-06-10 at 19:22, Tor Henrik Hanken wrote:
> [EMAIL PROTECTED]
> 
> | Yes, but to clarify...
> | I am showing a jsp page with values read from a database. If the
> | checkbox value is true, how do I then make the checkbox on my jsp-page
> | checked and how do I then find out if the checkbox has been unchecked?
> | Do I have to manually read the posted data and see if the checkbox
> | attribute is missing or is there a better way?
> 
> I assume that you are using an Action with an ActionForm.
> 
> To make the value of the checkbox come up correctly, import
> struts tags into your jsp-page: 
> 
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="strb" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="strh" %>
> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="strl" %>
> 
> Then use the Struts checkbox tag:
> 
> 
> 
> Assuming that your form has the methods getDone and setDone,
> these methods will be used to render the value of the checkbox
> correctly.
> 
> As to the question of boolean values that are set to false by the
> user: You don't have to parse the posted data manually.  The
> method reset() in ActionForm is run before the posted data is
> used to populate the form.  Write your own reset() method where
> you set the boolean fields to false.
-- 
---
Bjørn T Johansen (BSc,MNIF)
Executive Manager
[EMAIL PROTECTED]  Havleik Consulting
Phone : +47 67 54 15 17 Conradisvei 4
Fax : +47 67 54 13 91   N-1338 Sandvika
Cellular : +47 926 93 298   http://www.havleik.no
---
"The stickers on the side of the box said "Supported Platforms: Windows
98, Windows NT 4.0,
Windows 2000 or better", so clearly Linux was a supported platform."
---


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



Re: Checkbox problem?

2003-06-10 Thread James Mitchell
On Tuesday 10 June 2003 14:11, Bjørn T Johansen wrote:
> You are missing my point! If I just could set the checkbox value to
> false in the reset method, everything is fine. But there are times when
> that value has to be reset to true and not false and if I do that in my
> reset method, I am not able to see of the user unchek the checkbox,
> because the boolean variable is still true after the form has been
> posted!

No, actually *YOU* are missing the point!  Several people have tried to 
explain how this works to you.

So, for one last effort


DO *NOT* SET THE FIELDS YOU INTENT TO USE AS CHECKBOXES (booleans) TO TRUE IN 
THE RESET METHOD!  


If you want the field to be true when the page is rendered, set it to true 
from your action class, NOT in the reset of your formbean.

I hope that clears it up for you.


>
>
> BTJ
>
> On Tue, 2003-06-10 at 19:22, Tor Henrik Hanken wrote:
> > [EMAIL PROTECTED]
> >
> > | Yes, but to clarify...
> > | I am showing a jsp page with values read from a database. If the
> > | checkbox value is true, how do I then make the checkbox on my jsp-page
> > | checked and how do I then find out if the checkbox has been unchecked?
> > | Do I have to manually read the posted data and see if the checkbox
> > | attribute is missing or is there a better way?
> >
> > I assume that you are using an Action with an ActionForm.
> >
> > To make the value of the checkbox come up correctly, import
> > struts tags into your jsp-page:
> >
> > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="strb" %>
> > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="strh" %>
> > <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="strl" %>
> >
> > Then use the Struts checkbox tag:
> >
> > 
> >
> > Assuming that your form has the methods getDone and setDone,
> > these methods will be used to render the value of the checkbox
> > correctly.
> >
> > As to the question of boolean values that are set to false by the
> > user: You don't have to parse the posted data manually.  The
> > method reset() in ActionForm is run before the posted data is
> > used to populate the form.  Write your own reset() method where
> > you set the boolean fields to false.

-- 
James Mitchell
Software Developer/Struts Evangelist
http://www.struts-atlanta.org
770-822-3359
AIM:jmitchtx



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



RE: Checkbox problem?

2003-06-10 Thread Mark Galbreath
Go get 'em, James!

-Original Message-
From: James Mitchell [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 10, 2003 2:29 PM
To: Struts Users Mailing List
Subject: Re: Checkbox problem?


On Tuesday 10 June 2003 14:11, Bjørn T Johansen wrote:
> You are missing my point! If I just could set the checkbox value to 
> false in the reset method, everything is fine. But there are times 
> when that value has to be reset to true and not false and if I do that 
> in my reset method, I am not able to see of the user unchek the 
> checkbox, because the boolean variable is still true after the form 
> has been posted!

No, actually *YOU* are missing the point!  Several people have tried to 
explain how this works to you.

So, for one last effort


DO *NOT* SET THE FIELDS YOU INTENT TO USE AS CHECKBOXES (booleans) TO TRUE
IN 
THE RESET METHOD!  


If you want the field to be true when the page is rendered, set it to true 
from your action class, NOT in the reset of your formbean.

I hope that clears it up for you.


>
>
> BTJ
>
> On Tue, 2003-06-10 at 19:22, Tor Henrik Hanken wrote:
> > [EMAIL PROTECTED]
> >
> > | Yes, but to clarify...
> > | I am showing a jsp page with values read from a database. If the 
> > | checkbox value is true, how do I then make the checkbox on my 
> > | jsp-page checked and how do I then find out if the checkbox has 
> > | been unchecked? Do I have to manually read the posted data and see 
> > | if the checkbox attribute is missing or is there a better way?
> >
> > I assume that you are using an Action with an ActionForm.
> >
> > To make the value of the checkbox come up correctly, import struts 
> > tags into your jsp-page:
> >
> > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="strb" %> <%@ 
> > taglib uri="/WEB-INF/struts-html.tld" prefix="strh" %> <%@ taglib 
> > uri="/WEB-INF/struts-logic.tld" prefix="strl" %>
> >
> > Then use the Struts checkbox tag:
> >
> > 
> >
> > Assuming that your form has the methods getDone and setDone, these 
> > methods will be used to render the value of the checkbox correctly.
> >
> > As to the question of boolean values that are set to false by the
> > user: You don't have to parse the posted data manually.  The method 
> > reset() in ActionForm is run before the posted data is used to 
> > populate the form.  Write your own reset() method where you set the 
> > boolean fields to false.

-- 
James Mitchell
Software Developer/Struts Evangelist http://www.struts-atlanta.org
770-822-3359 AIM:jmitchtx



-
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: Checkbox problem?

2003-06-10 Thread Bjørn T Johansen
oki, maybe my explanation isn't the best :) (I know that I can't do it
in the reset method, as it is clearly not working)  but I am still not
sure where to put the code to set the checkbox to true then.
As far as I know, the action class isn't called before after the form
bean has called the reset method and the page has been rendered (and the
submit button has been pressed), or is it something I am missing?

BTJ

On Tue, 2003-06-10 at 20:28, James Mitchell wrote:
> On Tuesday 10 June 2003 14:11, Bjørn T Johansen wrote:
> > You are missing my point! If I just could set the checkbox value to
> > false in the reset method, everything is fine. But there are times when
> > that value has to be reset to true and not false and if I do that in my
> > reset method, I am not able to see of the user unchek the checkbox,
> > because the boolean variable is still true after the form has been
> > posted!
> 
> No, actually *YOU* are missing the point!  Several people have tried to 
> explain how this works to you.
> 
> So, for one last effort
> 
> 
> DO *NOT* SET THE FIELDS YOU INTENT TO USE AS CHECKBOXES (booleans) TO TRUE IN 
> THE RESET METHOD!  
> 
> 
> If you want the field to be true when the page is rendered, set it to true 
> from your action class, NOT in the reset of your formbean.
> 
> I hope that clears it up for you.
> 
> 
> >
> >
> > BTJ
> >
> > On Tue, 2003-06-10 at 19:22, Tor Henrik Hanken wrote:
> > > [EMAIL PROTECTED]
> > >
> > > | Yes, but to clarify...
> > > | I am showing a jsp page with values read from a database. If the
> > > | checkbox value is true, how do I then make the checkbox on my jsp-page
> > > | checked and how do I then find out if the checkbox has been unchecked?
> > > | Do I have to manually read the posted data and see if the checkbox
> > > | attribute is missing or is there a better way?
> > >
> > > I assume that you are using an Action with an ActionForm.
> > >
> > > To make the value of the checkbox come up correctly, import
> > > struts tags into your jsp-page:
> > >
> > > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="strb" %>
> > > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="strh" %>
> > > <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="strl" %>
> > >
> > > Then use the Struts checkbox tag:
> > >
> > > 
> > >
> > > Assuming that your form has the methods getDone and setDone,
> > > these methods will be used to render the value of the checkbox
> > > correctly.
> > >
> > > As to the question of boolean values that are set to false by the
> > > user: You don't have to parse the posted data manually.  The
> > > method reset() in ActionForm is run before the posted data is
> > > used to populate the form.  Write your own reset() method where
> > > you set the boolean fields to false.



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



RE: Checkbox problem?

2003-06-10 Thread Josh Rayls
public ... execute (..., , ) {

BeanUtils.setProperty(actionForm, "checkboxPropertyName", "true" )

}

or something similar, I believe.

-Josh

-Original Message-
From: Bjørn T Johansen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 3:38 PM
To: Struts Users Mailing List
Subject: Re: Checkbox problem?


oki, maybe my explanation isn't the best :) (I know that I can't do it
in the reset method, as it is clearly not working)  but I am still not
sure where to put the code to set the checkbox to true then.
As far as I know, the action class isn't called before after the form
bean has called the reset method and the page has been rendered (and the
submit button has been pressed), or is it something I am missing?

BTJ

On Tue, 2003-06-10 at 20:28, James Mitchell wrote:
> On Tuesday 10 June 2003 14:11, Bjørn T Johansen wrote:
> > You are missing my point! If I just could set the checkbox value to
> > false in the reset method, everything is fine. But there are times when
> > that value has to be reset to true and not false and if I do that in my
> > reset method, I am not able to see of the user unchek the checkbox,
> > because the boolean variable is still true after the form has been
> > posted!
> 
> No, actually *YOU* are missing the point!  Several people have tried to 
> explain how this works to you.
> 
> So, for one last effort
> 
> 
> DO *NOT* SET THE FIELDS YOU INTENT TO USE AS CHECKBOXES (booleans) TO TRUE
IN 
> THE RESET METHOD!  
> 
> 
> If you want the field to be true when the page is rendered, set it to true

> from your action class, NOT in the reset of your formbean.
> 
> I hope that clears it up for you.
> 
> 
> >
> >
> > BTJ
> >
> > On Tue, 2003-06-10 at 19:22, Tor Henrik Hanken wrote:
> > > [EMAIL PROTECTED]
> > >
> > > | Yes, but to clarify...
> > > | I am showing a jsp page with values read from a database. If the
> > > | checkbox value is true, how do I then make the checkbox on my
jsp-page
> > > | checked and how do I then find out if the checkbox has been
unchecked?
> > > | Do I have to manually read the posted data and see if the checkbox
> > > | attribute is missing or is there a better way?
> > >
> > > I assume that you are using an Action with an ActionForm.
> > >
> > > To make the value of the checkbox come up correctly, import
> > > struts tags into your jsp-page:
> > >
> > > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="strb" %>
> > > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="strh" %>
> > > <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="strl" %>
> > >
> > > Then use the Struts checkbox tag:
> > >
> > > 
> > >
> > > Assuming that your form has the methods getDone and setDone,
> > > these methods will be used to render the value of the checkbox
> > > correctly.
> > >
> > > As to the question of boolean values that are set to false by the
> > > user: You don't have to parse the posted data manually.  The
> > > method reset() in ActionForm is run before the posted data is
> > > used to populate the form.  Write your own reset() method where
> > > you set the boolean fields to false.



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


Re: Checkbox problem?

2003-06-10 Thread Kevin Robair
You can pre-populate the form in a previous action. Here is an example.

http://jakarta.apache.org/struts/faqs/newbie.html#prepopulate

-Kevin

--- Bjørn T Johansen <[EMAIL PROTECTED]> wrote:
> oki, maybe my explanation isn't the best :) (I know that I can't do it
> in the reset method, as it is clearly not working)  but I am still not
> sure where to put the code to set the checkbox to true then.
> As far as I know, the action class isn't called before after the form
> bean has called the reset method and the page has been rendered (and the
> submit button has been pressed), or is it something I am missing?
> 
> BTJ
> 
> On Tue, 2003-06-10 at 20:28, James Mitchell wrote:
> > On Tuesday 10 June 2003 14:11, Bjørn T Johansen wrote:
> > > You are missing my point! If I just could set the checkbox value to
> > > false in the reset method, everything is fine. But there are times
> when
> > > that value has to be reset to true and not false and if I do that in
> my
> > > reset method, I am not able to see of the user unchek the checkbox,
> > > because the boolean variable is still true after the form has been
> > > posted!
> > 
> > No, actually *YOU* are missing the point!  Several people have tried
> to 
> > explain how this works to you.
> > 
> > So, for one last effort
> > 
> > 
> > DO *NOT* SET THE FIELDS YOU INTENT TO USE AS CHECKBOXES (booleans) TO
> TRUE IN 
> > THE RESET METHOD!  
> > 
> > 
> > If you want the field to be true when the page is rendered, set it to
> true 
> > from your action class, NOT in the reset of your formbean.
> > 
> > I hope that clears it up for you.
> > 
> > 
> > >
> > >
> > > BTJ
> > >
> > > On Tue, 2003-06-10 at 19:22, Tor Henrik Hanken wrote:
> > > > [EMAIL PROTECTED]
> > > >
> > > > | Yes, but to clarify...
> > > > | I am showing a jsp page with values read from a database. If the
> > > > | checkbox value is true, how do I then make the checkbox on my
> jsp-page
> > > > | checked and how do I then find out if the checkbox has been
> unchecked?
> > > > | Do I have to manually read the posted data and see if the
> checkbox
> > > > | attribute is missing or is there a better way?
> > > >
> > > > I assume that you are using an Action with an ActionForm.
> > > >
> > > > To make the value of the checkbox come up correctly, import
> > > > struts tags into your jsp-page:
> > > >
> > > > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="strb" %>
> > > > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="strh" %>
> > > > <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="strl" %>
> > > >
> > > > Then use the Struts checkbox tag:
> > > >
> > > > 
> > > >
> > > > Assuming that your form has the methods getDone and setDone,
> > > > these methods will be used to render the value of the checkbox
> > > > correctly.
> > > >
> > > > As to the question of boolean values that are set to false by the
> > > > user: You don't have to parse the posted data manually.  The
> > > > method reset() in ActionForm is run before the posted data is
> > > > used to populate the form.  Write your own reset() method where
> > > > you set the boolean fields to false.
> 
> 
> 
> -
> 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: Checkbox problem?

2003-06-10 Thread Karr, David
Generally, a good strategy is to have a "prepare" action and a "process" action.  Your 
"prepare" action is where you would set your boolean form properties.  You then 
forward to the JSP, which renders the checkboxes.  The "process" action (from 
submitting the form) will determine whether the checkboxes are set or not.

> -Original Message-
> From: Bjørn T Johansen [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 10, 2003 12:38 PM
> To: Struts Users Mailing List
> Subject: Re: Checkbox problem?
> 
> oki, maybe my explanation isn't the best :) (I know that I can't do it
> in the reset method, as it is clearly not working)  but I am still not
> sure where to put the code to set the checkbox to true then.
> As far as I know, the action class isn't called before after the form
> bean has called the reset method and the page has been rendered (and the
> submit button has been pressed), or is it something I am missing?
> 
> BTJ
> 
> On Tue, 2003-06-10 at 20:28, James Mitchell wrote:
> > On Tuesday 10 June 2003 14:11, Bjørn T Johansen wrote:
> > > You are missing my point! If I just could set the checkbox value to
> > > false in the reset method, everything is fine. But there are times
> when
> > > that value has to be reset to true and not false and if I do that in
> my
> > > reset method, I am not able to see of the user unchek the checkbox,
> > > because the boolean variable is still true after the form has been
> > > posted!
> >
> > No, actually *YOU* are missing the point!  Several people have tried to
> > explain how this works to you.
> >
> > So, for one last effort
> >
> > 
> > DO *NOT* SET THE FIELDS YOU INTENT TO USE AS CHECKBOXES (booleans) TO
> TRUE IN
> > THE RESET METHOD!
> > 
> >
> > If you want the field to be true when the page is rendered, set it to
> true
> > from your action class, NOT in the reset of your formbean.
> >
> > I hope that clears it up for you.
> >
> >
> > >
> > >
> > > BTJ
> > >
> > > On Tue, 2003-06-10 at 19:22, Tor Henrik Hanken wrote:
> > > > [EMAIL PROTECTED]
> > > >
> > > > | Yes, but to clarify...
> > > > | I am showing a jsp page with values read from a database. If the
> > > > | checkbox value is true, how do I then make the checkbox on my jsp-
> page
> > > > | checked and how do I then find out if the checkbox has been
> unchecked?
> > > > | Do I have to manually read the posted data and see if the checkbox
> > > > | attribute is missing or is there a better way?
> > > >
> > > > I assume that you are using an Action with an ActionForm.
> > > >
> > > > To make the value of the checkbox come up correctly, import
> > > > struts tags into your jsp-page:
> > > >
> > > > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="strb" %>
> > > > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="strh" %>
> > > > <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="strl" %>
> > > >
> > > > Then use the Struts checkbox tag:
> > > >
> > > > 
> > > >
> > > > Assuming that your form has the methods getDone and setDone,
> > > > these methods will be used to render the value of the checkbox
> > > > correctly.
> > > >
> > > > As to the question of boolean values that are set to false by the
> > > > user: You don't have to parse the posted data manually.  The
> > > > method reset() in ActionForm is run before the posted data is
> > > > used to populate the form.  Write your own reset() method where
> > > > you set the boolean fields to false.
> 
> 
> 
> -
> 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: Checkbox problem?

2003-06-10 Thread Steve Raeburn
The suggested method requires two actions.

  SetupAction -> Form -> ProcessAction

The first action prepares any values required by your form, including
setting the value of your checkboxes to true. The second action is the one
that actually processes the user input gathered by the form.

Hope this clarifies things.

Steve

> -Original Message-
> From: Bjørn T Johansen [mailto:[EMAIL PROTECTED]
> Sent: June 10, 2003 12:38 PM
> To: Struts Users Mailing List
> Subject: Re: Checkbox problem?
>
>
> oki, maybe my explanation isn't the best :) (I know that I can't do it
> in the reset method, as it is clearly not working)  but I am still not
> sure where to put the code to set the checkbox to true then.
> As far as I know, the action class isn't called before after the form
> bean has called the reset method and the page has been rendered (and the
> submit button has been pressed), or is it something I am missing?
>
> BTJ
>


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



RE: Checkbox problem?

2003-06-10 Thread Wendy Smoak
Steve wrote:
> The suggested method requires two actions.
>   SetupAction -> Form -> ProcessAction
> The first action prepares any values required by your form, 
> including setting the value of your checkboxes to true. The 
> second action is the one that actually processes the user 
> input gathered by the form.

Not necessarily two Actions... I use LookupDispatchAction with a request
parameter to control which method should be called.

-- 
Wendy Smoak


RE: Checkbox problem?

2003-06-11 Thread Bjørn T Johansen
Oki, thanks for all your suggestions; I'll try them out and see what
happens... :)


BTJ

On Tue, 2003-06-10 at 22:11, Steve Raeburn wrote:
> The suggested method requires two actions.
> 
>   SetupAction -> Form -> ProcessAction
> 
> The first action prepares any values required by your form, including
> setting the value of your checkboxes to true. The second action is the one
> that actually processes the user input gathered by the form.
> 
> Hope this clarifies things.
> 
> Steve
> 
> > -Original Message-
> > From: Bjørn T Johansen [mailto:[EMAIL PROTECTED]
> > Sent: June 10, 2003 12:38 PM
> > To: Struts Users Mailing List
> > Subject: Re: Checkbox problem?
> >
> >
> > oki, maybe my explanation isn't the best :) (I know that I can't do it
> > in the reset method, as it is clearly not working)  but I am still not
> > sure where to put the code to set the checkbox to true then.
> > As far as I know, the action class isn't called before after the form
> > bean has called the reset method and the page has been rendered (and the
> > submit button has been pressed), or is it something I am missing?
> >
> > BTJ
> >
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
-- 
---
Bjørn T Johansen (BSc,MNIF)
Executive Manager
[EMAIL PROTECTED]  Havleik Consulting
Phone : +47 67 54 15 17 Conradisvei 4
Fax : +47 67 54 13 91   N-1338 Sandvika
Cellular : +47 926 93 298   http://www.havleik.no
---
"The stickers on the side of the box said "Supported Platforms: Windows
98, Windows NT 4.0,
Windows 2000 or better", so clearly Linux was a supported platform."
---


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



RE: Checkbox problem

2002-10-24 Thread Sri Sankaran
I suppose you have several checkboxes corresponding to the List of objects.

Are you using the  tag?  If not, you should.  The Struts framework will 
save the selected values in a String array that you provide.  The value stored will be 
the value of the checkbox.  For example



if the checkbox is selected the array will include the string 'foo'.

Have you looked at the html-multibox.jsp that is part of the struts-exercise-taglib 
application that ships with Struts?

Sri

-Original Message-
From: Kishore, Sahu [mailto:kishores@;tanning.com] 
Sent: Thursday, October 24, 2002 3:19 AM
To: '[EMAIL PROTECTED]'
Subject: Checkbox problem



In my form bean I have an attribute which is an Arraylist of  objects who in turn 
contain many attributes one of which is a string representing 
a checkbox of my screen.

Problem :

-When I check anyof the check boxes and proceed to the next screens and 
comeback again to the screen having the check boxes to uncheck 
  some of the checkboxes which I have checked earlier then it's not getting 
updated in the form bean.
 I have taken the default value of the attribute representing the checkbox as 
false. And when it gets checked I'm making it to True.

So any solution?


Thanks 
Kishor


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: checkbox problem

2002-11-11 Thread Saini, Deepank
may u need to reset the value of the checkbox to (false or true) in the
reset method of ur formbean

-Original Message-
From: Hirschmann, Bernhard [mailto:Bernhard.Hirschmann@;t-systems.com]
Sent: Monday, November 11, 2002 7:00 PM
To: '[EMAIL PROTECTED]'
Subject: checkbox problem



Hello Struts user!

I use a html:checkbox for setting a boolean value. But after submit, the
boolean value in the form bean isn't set correctly.

Do I have to use a String value for that in my form bean? I tried this, but
without success.

Regards,
Bernhard

--
To unsubscribe, e-mail:

For additional commands, e-mail:



This message contains information that may be privileged or confidential and
is the property of the Cap Gemini Ernst & Young Group. It is intended only
for the person to whom it is addressed. If you are not the intended
recipient, you are not authorised to read, print, retain, copy, disseminate,
distribute, or use this message or any part thereof. If you receive this
message in error, please notify the sender immediately and delete all copies
of this message.

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: checkbox problem

2002-11-11 Thread James Mitchell
You need to set it to false in the reset() method.

James Mitchell
Software Engineer/Struts Evangelist
http://www.open-tools.org

"If you were plowing a field, which would you rather use? Two strong oxen or
1024 chickens?"
- Seymour Cray (1925-1996), father of supercomputing


> -Original Message-
> From: Saini, Deepank [mailto:deepank.saini@;cgey.com]
> Sent: Monday, November 11, 2002 8:33 AM
> To: 'Struts Users Mailing List'
> Subject: RE: checkbox problem
>
>
> may u need to reset the value of the checkbox to (false or true) in the
> reset method of ur formbean
>
> -Original Message-
> From: Hirschmann, Bernhard [mailto:Bernhard.Hirschmann@;t-systems.com]
> Sent: Monday, November 11, 2002 7:00 PM
> To: '[EMAIL PROTECTED]'
> Subject: checkbox problem
>
>
>
> Hello Struts user!
>
> I use a html:checkbox for setting a boolean value. But after submit, the
> boolean value in the form bean isn't set correctly.
>
> Do I have to use a String value for that in my form bean? I tried
> this, but
> without success.
>
> Regards,
> Bernhard
>
> --
> To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@;jakarta.apache.org>
>
> 
> This message contains information that may be privileged or
> confidential and
> is the property of the Cap Gemini Ernst & Young Group. It is intended only
> for the person to whom it is addressed. If you are not the intended
> recipient, you are not authorised to read, print, retain, copy,
> disseminate,
> distribute, or use this message or any part thereof. If you receive this
> message in error, please notify the sender immediately and delete
> all copies
> of this message.
>
> --
> 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>




RE: checkbox problem

2002-11-11 Thread Saini, Deepank
if u want uncheck the box, after a submit , set it to false

-Original Message-
From: James Mitchell [mailto:jmitchtx@;telocity.com]
Sent: Monday, November 11, 2002 7:06 PM
To: Struts Users Mailing List
Subject: RE: checkbox problem


You need to set it to false in the reset() method.

James Mitchell
Software Engineer/Struts Evangelist
http://www.open-tools.org

"If you were plowing a field, which would you rather use? Two strong oxen or
1024 chickens?"
- Seymour Cray (1925-1996), father of supercomputing


> -Original Message-
> From: Saini, Deepank [mailto:deepank.saini@;cgey.com]
> Sent: Monday, November 11, 2002 8:33 AM
> To: 'Struts Users Mailing List'
> Subject: RE: checkbox problem
>
>
> may u need to reset the value of the checkbox to (false or true) in the
> reset method of ur formbean
>
> -Original Message-
> From: Hirschmann, Bernhard [mailto:Bernhard.Hirschmann@;t-systems.com]
> Sent: Monday, November 11, 2002 7:00 PM
> To: '[EMAIL PROTECTED]'
> Subject: checkbox problem
>
>
>
> Hello Struts user!
>
> I use a html:checkbox for setting a boolean value. But after submit, the
> boolean value in the form bean isn't set correctly.
>
> Do I have to use a String value for that in my form bean? I tried
> this, but
> without success.
>
> Regards,
> Bernhard
>
> --
> To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@;jakarta.apache.org>
>
> 
> This message contains information that may be privileged or
> confidential and
> is the property of the Cap Gemini Ernst & Young Group. It is intended only
> for the person to whom it is addressed. If you are not the intended
> recipient, you are not authorised to read, print, retain, copy,
> disseminate,
> distribute, or use this message or any part thereof. If you receive this
> message in error, please notify the sender immediately and delete
> all copies
> of this message.
>
> --
> 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>


This message contains information that may be privileged or confidential and
is the property of the Cap Gemini Ernst & Young Group. It is intended only
for the person to whom it is addressed. If you are not the intended
recipient, you are not authorised to read, print, retain, copy, disseminate,
distribute, or use this message or any part thereof. If you receive this
message in error, please notify the sender immediately and delete all copies
of this message.

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




RE: checkbox problem

2002-11-11 Thread Saini, Deepank
well i am not sure why it should show true if it has been unchecked, but one
last shot, if u r calling a javascript function on the submit, the problem
could well be in the javascript function. 
Bye the way do u have a submit button or r u caling a javascript function
onchange of the checkbox?

-Original Message-
From: Hirschmann, Bernhard [mailto:Bernhard.Hirschmann@;t-systems.com]
Sent: Monday, November 11, 2002 7:12 PM
To: 'Struts Users Mailing List'
Subject: AW: checkbox problem



Thanks for your comment, but I'm not sure if that's the problem.

Here is the scenario:
1.) While populating the form, the value is true. 
2.) Then the user disables the checkbox - for setting the value to false.
3.) Submit occurs.
4.) In the action I check the value and I see that it is true. 

Do I really have to reset the form for such a scenario? 

Regards,
Bernhard


-Ursprüngliche Nachricht-
Von: James Mitchell [mailto:jmitchtx@;telocity.com]
Gesendet: Montag, 11. November 2002 14:36
An: Struts Users Mailing List
Betreff: RE: checkbox problem


You need to set it to false in the reset() method.

James Mitchell
Software Engineer/Struts Evangelist
http://www.open-tools.org

"If you were plowing a field, which would you rather use? Two strong oxen or
1024 chickens?"
- Seymour Cray (1925-1996), father of supercomputing


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


This message contains information that may be privileged or confidential and
is the property of the Cap Gemini Ernst & Young Group. It is intended only
for the person to whom it is addressed. If you are not the intended
recipient, you are not authorised to read, print, retain, copy, disseminate,
distribute, or use this message or any part thereof. If you receive this
message in error, please notify the sender immediately and delete all copies
of this message.

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




/ /OREF:CPTD2D27 RE: checkbox problem

2002-11-11 Thread avasey

This posting is useful for dealing with checkboxes:
http://www.mail-archive.com/struts-user@;jakarta.apache.org/msg37244.html



   

  "Saini, Deepank" 

   
  gey.com> cc: 

       Subject: RE: checkbox problem   

  11/11/2002 03:46 

  PM   

  Please respond   

  to "Struts Users 

  Mailing List"

   

   

   

   

   





well i am not sure why it should show true if it has been unchecked,
but one
last shot, if u r calling a javascript function on the submit, the
problem
could well be in the javascript function.
Bye the way do u have a submit button or r u caling a javascript
function
onchange of the checkbox?

-Original Message-
From: Hirschmann, Bernhard [mailto:Bernhard.Hirschmann@;t-systems.com]
Sent: Monday, November 11, 2002 7:12 PM
To: 'Struts Users Mailing List'
Subject: AW: checkbox problem



Thanks for your comment, but I'm not sure if that's the problem.

Here is the scenario:
1.) While populating the form, the value is true.
2.) Then the user disables the checkbox - for setting the value to
false.
3.) Submit occurs.
4.) In the action I check the value and I see that it is true.

Do I really have to reset the form for such a scenario?

Regards,
Bernhard


-Ursprüngliche Nachricht-
Von: James Mitchell [mailto:jmitchtx@;telocity.com]
Gesendet: Montag, 11. November 2002 14:36
An: Struts Users Mailing List
Betreff: RE: checkbox problem


You need to set it to false in the reset() method.

James Mitchell
Software Engineer/Struts Evangelist
http://www.open-tools.org

"If you were plowing a field, which would you rather use? Two strong
oxen or
1024 chickens?"
- Seymour Cray (1925-1996), father of supercomputing


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


This message contains information that may be privileged or
confidential and
is the property of the Cap Gemini Ernst & Young Group. It is intended
only
for the person to whom it is addressed. If you are not the intended
recipient, you are not authorised to read, print, retain, copy,
disseminate,
distribute, or use this message or any part thereof. If you receive
this
message in error, please notify the sender immediately and delete all
copies
of this message.

--
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>




RE: CheckBox problem in struts..

2002-04-06 Thread srinivas

reset the check box values in the struts form reset method.


-Original Message-
From: Sachin [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 6:35 PM
To: [EMAIL PROTECTED]
Subject: CheckBox problem in struts..


Hi
Could anyone explain about the checkbox problem in struts
if i have a checkbox in a jsp and if i set the value of the bean to yes,
true or on, the checkbox will be checked. But if i try to set the value of
the checkbox in the bean it is not getting set. if i submit data from
checkbox it is not getting reflected when i revisit the page.

Thanks & Regards
Sachin


--
To unsubscribe, e-mail:

For additional commands, e-mail:




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: CheckBox problem in struts..

2002-04-06 Thread Alex Paransky

The reset(...) method in your form needs to reset the checkbox to "false",
every time.

-AP_
http://www.alexparansky.com
Java/J2EE Architect/Consultant
http://www.myprofiles.com/member/view.do?profileId=127

-Original Message-
From: Sachin [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 7:35 AM
To: [EMAIL PROTECTED]
Subject: CheckBox problem in struts..


Hi
Could anyone explain about the checkbox problem in struts
if i have a checkbox in a jsp and if i set the value of the bean to yes,
true or on, the checkbox will be checked. But if i try to set the value of
the checkbox in the bean it is not getting set. if i submit data from
checkbox it is not getting reflected when i revisit the page.

Thanks & Regards
Sachin


--
To unsubscribe, e-mail:

For additional commands, e-mail:




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Checkbox problem still not fixed :(

2001-06-28 Thread Linnea Ahlbeck



Hi! 
I had a similar problem and solved it by changing 
the attribute scope in my 
action in the struts-config.xml file to request 
instead of session.
/Linnéa

  - Original Message - 
  From: 
  Joel Vogt 
  
  To: [EMAIL PROTECTED] 
  Sent: Thursday, June 28, 2001 10:04 
  AM
  Subject: Checkbox problem still not fixed 
  :(
  
  Hi everyone.
   
  I've tried just about everything in the mail 
  archive but can't get check/multi boxes to perform how I want to.
  I use an iterate tag over a collection, basically 
  on my jsp page I have as follows
   
  
  blah  blah  
  
   
  In my form bean I have an array pk[] and another 
  member[].
  In the reset method I do:
  for(int i = 
0;i
      member[i] = 
  "false";
   
  When I check the values off the form in my action 
  class, i still only get the values set to true. I need a long list, true, 
  false, true, true etc for all the values.
   
  Sorry to be a pain but can someone give me some 
  sort of 'exact' steps to solve the problem? I haven't been able to piece 
  together all the help on the mail archive.
   
  Thanks,
  Joel
  [EMAIL PROTECTED]


Re: Checkbox problem still not fixed :(

2001-06-28 Thread Joel Vogt



Hi all,
 
I've worked on it a bit more and come up with these 
steps to make it work.
 
I use a multibox instead of a checkbox like this on 
my form:
 

 
I then also include with this a hidden 
field
 

 
The form bean remains the same.

 
In my action class, I can then get the required 
values by looping like this
 
 int j = 
0;  for (int i = 0; 
i  
{    if 
(member[j].equals("yes"))    
{  // This person is a 
member so do required 
events;  
j+=1;    
}    
else  // this 
person is marked to not be a member
    
j+=1;  }
 
This works because if the multibox was checked to 
true, there will be two values for each user, a true for the multibox and then 
the no from the hidden field.
If the multibox is not checked then we only get one 
entry, a no from the hidden field.
 
To me this is a bit ineligant. Sure it works, 
but...
 
Any other solutions?
 
Btw Thanks to all the people offering help on this, 
it seems struts has a good community going.
 
Joel.


  - Original Message - 
  From: 
  Joel Vogt 
  
  To: [EMAIL PROTECTED] 
  
  Sent: Thursday, June 28, 2001 10:04 
  AM
  Subject: Checkbox problem still not fixed 
  :(
  
  Hi everyone.
   
  I've tried just about everything in the mail 
  archive but can't get check/multi boxes to perform how I want to.
  I use an iterate tag over a collection, basically 
  on my jsp page I have as follows
   
  
  blah  blah  
  
   
  In my form bean I have an array pk[] and another 
  member[].
  In the reset method I do:
  for(int i = 
0;i
      member[i] = 
  "false";
   
  When I check the values off the form in my action 
  class, i still only get the values set to true. I need a long list, true, 
  false, true, true etc for all the values.
   
  Sorry to be a pain but can someone give me some 
  sort of 'exact' steps to solve the problem? I haven't been able to piece 
  together all the help on the mail archive.
   
  Thanks,
  Joel
  [EMAIL PROTECTED]