RE: Getting data from a disabled form field

2004-02-12 Thread Andrew Hill
Yep. The browser doesnt submit a value for the field if its disabled.

If your using a request scoped actionform then you will either need to
reload its value from wherever or add an additional hidden field on the
form to submit the value. If its a session scoped form, just make sure that
you dont clear it in reset.

btw: if this is a security thing then you must make sure that your setters
(or something else server side) dont accept different values for these
fields when the user hasnt got appropriate rights as a user can easily play
silly buggers with the url and script kiddies can easily spoof POST
requests - both bypassing any kind of client side validation or 'security'.

-Original Message-
From: Arne Brutschy [mailto:[EMAIL PROTECTED]
Sent: Thursday, 12 February 2004 21:32
To: Struts Users Mailing List
Subject: Getting data from a disabled form field


Hi,

I have a problem with disabled form fields. I'm using a user entry form,
which fields can be edited by the current user based on his group
memberships. So a normal user without admin status cannot change the
uid, as this field is disabled.

My problem is, that after submitting the form, validation fails because
of the validator which cannot read the uids field context (I assume
because it's disabled). Trying to get the form data returns an empty string.

Anyone encountered this type of problem? Is there any way around it?

Regards,
Arne


-
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: Getting data from a disabled form field

2004-02-12 Thread Mark Lowe
i believe that disabled form elements return null.

I hate to say it, but you could have the uid stored as a hidden 
variable in the case of the non admin user but still display a text 
field with the value displayed.

On 12 Feb 2004, at 14:31, Arne Brutschy wrote:

Hi,

I have a problem with disabled form fields. I'm using a user entry 
form, which fields can be edited by the current user based on his 
group memberships. So a normal user without admin status cannot change 
the uid, as this field is disabled.

My problem is, that after submitting the form, validation fails 
because of the validator which cannot read the uids field context (I 
assume because it's disabled). Trying to get the form data returns an 
empty string.

Anyone encountered this type of problem? Is there any way around it?

Regards,
Arne
-
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: Getting data from a disabled form field

2004-02-12 Thread Angharad Stapleton
Try using Javascript to re-enable the fields when the form is submitted,
this allows them to be passed through to the form as normal.

-Original Message-
From: Mark Lowe [mailto:[EMAIL PROTECTED]
Sent: 12 February 2004 13:46
To: Struts Users Mailing List
Subject: Re: Getting data from a disabled form field


i believe that disabled form elements return null.

I hate to say it, but you could have the uid stored as a hidden
variable in the case of the non admin user but still display a text
field with the value displayed.


On 12 Feb 2004, at 14:31, Arne Brutschy wrote:

 Hi,

 I have a problem with disabled form fields. I'm using a user entry
 form, which fields can be edited by the current user based on his
 group memberships. So a normal user without admin status cannot change
 the uid, as this field is disabled.

 My problem is, that after submitting the form, validation fails
 because of the validator which cannot read the uids field context (I
 assume because it's disabled). Trying to get the form data returns an
 empty string.

 Anyone encountered this type of problem? Is there any way around it?

 Regards,
 Arne


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


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



RE: Getting data from a disabled form field

2004-02-12 Thread Andrew Hill
They dont submit any parameter in the posted request. As a result, when
struts populates the form, iterating the list of request parameters and
calling the setters with the values it wont call the setter for that one.

The value in the actionform thus depends upon the logic in the forms reset
method - and if that field is not reset, upon the pre-existing value in the
actionform which will remain unchanged. In the case of a request scoped
form, this will of course be a new actionform instance so will give whatever
the forms initial value is when the form is created. (Usually null)

-Original Message-
From: Mark Lowe [mailto:[EMAIL PROTECTED]
Sent: Thursday, 12 February 2004 21:46
To: Struts Users Mailing List
Subject: Re: Getting data from a disabled form field


i believe that disabled form elements return null.

I hate to say it, but you could have the uid stored as a hidden
variable in the case of the non admin user but still display a text
field with the value displayed.


On 12 Feb 2004, at 14:31, Arne Brutschy wrote:

 Hi,

 I have a problem with disabled form fields. I'm using a user entry
 form, which fields can be edited by the current user based on his
 group memberships. So a normal user without admin status cannot change
 the uid, as this field is disabled.

 My problem is, that after submitting the form, validation fails
 because of the validator which cannot read the uids field context (I
 assume because it's disabled). Trying to get the form data returns an
 empty string.

 Anyone encountered this type of problem? Is there any way around it?

 Regards,
 Arne


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



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