• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts <html:text ... issue.

 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm a new bie to Struts 1.x version.
I have an issue with <html:text .... > element as shown below



I submit the form and when i retrieve in the action class. I'm getting as null.




Please help me out with this ranchers.

Thanks and Regards,
Deepak Lal
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34073
335
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deepak,
Disabled fields are not submitted from the browser to the server. This means that request.getParameter() doesn't have access to the field, let alone Struts. One solution is to use JavaScript to copy the value to a hidden field which is submitted.
 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:

Deepak,
Disabled fields are not submitted from the browser to the server. This means that request.getParameter() doesn't have access to the field, let alone Struts. One solution is to use JavaScript to copy the value to a hidden field which is submitted.




Hi Jeanne,
Thanks for the inputs,can you help me out with the snippet of code for setting the value to hidden form field when submit is called

Please find my code below



Please need your help with this.
 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne,
Could you please help me out with snippet of code which does that.?
Deepak Lal
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34073
335
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deepak Lal wrote:Hi Jeanne,
Could you please help me out with snippet of code which does that.?
Deepak Lal

I could, but you'll learn more by writing it yourself. Let's start with the pieces:
1) Do you know how to create a hidden field?
2) Do you know how to create a JavaScript function?
3) Do you know how to execute a JavaScript function on submit?
4) Do you know how to access the value of a field?

Post back what you have if you get stuck and then someone can help.
 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi jeanne,
Please correct me If im wrong in the below



Please help me out with this....

Thanks and Regards,
Deepak Lal
 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
COuld you please help me on this
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34073
335
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deepak,
First of all - be patient. It's best to allow up to 24 hours for a reply. Some people check the forums once a day.

Now on to your question. Remember that Struts generates HTML code. So there is nothing special about the JavaScript with respect to Struts. You just get the value of each element:
 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne,
Please correct if im wrong.
As you have told earlier in reply to post


Jeanne wrote::
Disabled fields are not submitted from the browser to the server. This means that request.getParameter() doesn't have access to the field, let alone Struts. One solution is to use JavaScript to copy the value to a hidden field which is submitted.


Since you are talking about copying the actual value to a hidden field,the below which you have suggested should be reversed...Please advice on this and please let me know if my understanding is correct or wrong.


Is the below correct


Thanks and Regardds
Deepak Lal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic