[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

onchange not working

Posted on 2006-04-01
12
Medium Priority
?
791 Views
Last Modified: 2008-06-17
i have 2 textboxes,

I enter some text into first textbox and when i finish, the second textbox value is given the first textboxes values. e.g it gets copied cover to second textbox.

what i cant get working is when the second textbox gets a value i want to fire an onchange event on the second textbox but i t never fires.

<input type="text" onblur="document.myform.theDate.value=this.value">

<input type="text" value="" name="theDate" onchange="date=this.value;updateDate('date');">

what am i doing wrong?
0
Comment
Question by:ellandrd
  • 5
  • 3
  • 3
  • +1
12 Comments
 
LVL 9

Assisted Solution

by:Lakio
Lakio earned 400 total points
ID: 16350638
can you give me the updateDate() code or just a whole page

date is a var so dont have ' '

<input type="text" value="" name="theDate" onchange="date=this.value;updateDate(date);">

or just

<input type="text" value="" name="theDate" onchange="updateDate(this.value);">
0
 
LVL 7

Assisted Solution

by:bubbledragon
bubbledragon earned 400 total points
ID: 16350647
The onchange event does not fire when the object is changed programatically.
0
 
LVL 9

Expert Comment

by:Lakio
ID: 16350965
why not do it like this?
<input type="text" onblur="document.myform.theDate.value=this.value;updateDate(this.value)">

<input type="text" value="" name="theDate" onchange="updateDate(this.value);">
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!

 
LVL 63

Accepted Solution

by:
Zvonko earned 1200 total points
ID: 16351727
Check also this:

<input type="text" onblur="dF=this.form.theDate;dF.value=this.value;dF.onchange()">

<input type="text" value="" name="theDate" onchange="date=this.value;updateDate('date');">

0
 
LVL 9

Expert Comment

by:Lakio
ID: 16352891
hehe I did not think of that :P
this.form.theDate
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16353763
what is dF?
0
 
LVL 63

Assisted Solution

by:Zvonko
Zvonko earned 1200 total points
ID: 16353773
dF is a var defined by assigning this.form.theDate input field reference.
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16353787
sorry im not with you?

so do i just create new var called dF?
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16353801
like your code works but i dont understand this dF var... im just ttying to understand what you did and maybe learn something new...
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 16354292
"so do i just create new var called dF?"
Yeap!

This version is only a short form:
<input type="text" onblur="dF=this.form.theDate;dF.value=this.value;dF.onchange()">

Of this:
<input type="text" onblur="this.form.theDate.value=this.value;this.form.theDate.onchange()">



0
 
LVL 9

Expert Comment

by:Lakio
ID: 16354305
and this is the long one:
<input type="text" onblur="document.myform.theDate.value=this.value;document.myform.theDate.theDate.onchange()">
0
 
LVL 9

Expert Comment

by:Lakio
ID: 16354306
<input type="text" onblur="document.myform.theDate.value=this.value;document.myform.theDate.onchange()"> *
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

831 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