Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help for JavaScript in Struts 1

 
vivek mahajan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In registration form i am using Permenent Address Field and Present Address field if any one has both the addresses same i am providing same button which call the follwoing finction on click


This function is used to copy Permanent Address to Present Address but its does nothing
and if i am displaying its value by


It Shows "undefined" value
Please Help
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vivek mahajan wrote:but its not working

http://faq.javaranch.com/java/ItDoesntWorkIsUseless

Its JS question and must be asked in HTML-JavaScript section, someone will move this for you there.
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
semi colons? ;
 
Kartik Tal
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vivek,

Instead of name use id so that you will get the value. Below is the code which i have used and its working fine

 
vivek mahajan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks kartik,
i know about document.getElementbyId but the problem is that the input is generated by the
and this code generates element by name not by id. I came to know that when i checked its sources code in browser
 
Kartik Tal
Ranch Hand
Posts: 103
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
then use using forms

 
vivek mahajan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks kartik
it worked thanks alot
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vivek mahajan wrote:thanks kartik,
i know about document.getElementbyId but the problem is that the input is generated by the
and this code generates element by name not by id.

If you need "id", you can any time use "styleId" which gets renered as "id", like
 
vivek mahajan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you sagar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic