Ganesh
Ganesh

Reputation: 123

struts validation can not work for disabled text field

I am designing update user information form in struts. In that, values from database are already set into text boxes. Also I have disabled text box for email so that user can not change email. I have applied client side struts validation to form

But If textfield is disabled, and contain valid value, then also struts validator framework trating it like blank.? If I enabled text field, it works fine.

Upvotes: 0

Views: 977

Answers (1)

Dave Newton
Dave Newton

Reputation: 160251

Disabled form fields are not submitted with forms. This is just how browsers work.

If you need the value sent anyway, send it as a hidden field. (Or enable the field via JavaScript on submission.) If the value needs to be displayed, consider just displaying it as text, not in a disabled field.

Upvotes: 2

Related Questions