wood burning stoves*
The moose likes Struts and the fly likes Help for JavaScript in Struts 1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Help for JavaScript in Struts 1" Watch "Help for JavaScript in Struts 1" New topic
Author

Help for JavaScript in Struts 1

vivek mahajan
Greenhorn

Joined: Jun 18, 2009
Posts: 22
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

Joined: Feb 19, 2008
Posts: 2902
    
    1

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.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

semi colons? ;


I love this place!
Kartik Talasu
Ranch Hand

Joined: Aug 21, 2009
Posts: 98
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

Joined: Jun 18, 2009
Posts: 22
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 Talasu
Ranch Hand

Joined: Aug 21, 2009
Posts: 98
then use using forms

vivek mahajan
Greenhorn

Joined: Jun 18, 2009
Posts: 22
thanks kartik
it worked thanks alot
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

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

Joined: Jun 18, 2009
Posts: 22
thank you sagar
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Help for JavaScript in Struts 1
 
Similar Threads
Javascript function isn't returning a value
Validate
How to remove Textbox Element using DOM in HTML
command button issue
Can <script> having src attribute contain any body or function?