?
Solved

velocity, javascript, html

Posted on 2008-11-07
8
Medium Priority
?
1,654 Views
Last Modified: 2013-11-23
can anypne help me rectify this code, i am getting object error  every time i check on the check box.... also i am not sure about embeddeding javascript and velocity code together....


#if($!{obj.flag} == 'y')
	 
	  #set($address = "$!{obj.add}") 
 
<input name="spouseadd" id="spouseadd" type="checkbox" value="true"  onClick="findadd(this);"></td>
 
<script language="JavaScript" type="text/JavaScript">
<!--
function findadd(checkField) {
  alert('getting called');
   if(checkField.checked){
   document.myform.street1.value=$address;
   
   }
 
}
 
//-->
</script>

Open in new window

0
Comment
Question by:sakvk
  • 3
  • 3
  • 2
8 Comments
 
LVL 15

Expert Comment

by:Tomarse111
ID: 22904832
Presumably on your page you have a form with name myform and a input with the name street1?
0
 

Author Comment

by:sakvk
ID: 22904857
yes, i have form with name myform and street1 is there
0
 
LVL 82

Accepted Solution

by:
hielo earned 1200 total points
ID: 22905238
I don't know what this:
document.myform.street1.value=$address;
   
is producing for you, but if the browser sees something like:
document.myform.street1.value=xyx somestreet name

then you need to quote the value so that it looks like:
document.myform.street1.value="xyx somestreet name"
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:sakvk
ID: 22905347
yeah...
from the velocity tag, i am getting the value of address which i am assignin to the textbox street1.
$address ='someaddress'
so
document.myform.street1.value=$address;
0
 
LVL 15

Assisted Solution

by:Tomarse111
Tomarse111 earned 800 total points
ID: 22905392
Have you tried

document.myform.street1.value='$address';

which is what i think heilo is getting at.
0
 
LVL 82

Expert Comment

by:hielo
ID: 22905421
>> i am assignin to the textbox street1.
$address ='someaddress'
Yes, but that is just assinging the string 'someaddress' (WITHOUT the apostrophes) to $address. But the javascript needs the quotes. You should be assigning something like:
$address ="'someaddress'"

OR alternatively:
document.myform.street1.value='$address';
0
 
LVL 82

Expert Comment

by:hielo
ID: 22905425
>>which is what i think heilo is getting at.
Exactly.
0
 

Author Closing Comment

by:sakvk
ID: 31514358
thanks a lot
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question