Solved

JavaScript Failure

Posted on 2014-11-04
6
98 Views
Last Modified: 2014-11-05
See attached.

Note the JavaScript to run the function recalc_start when the onChange event is triggered for the date item (named sdate).

It does NOT do that. Notice the alert at the start of that function. NEVER displays.

Why?

Of course this is part of something bigger; I just cut it down to the essentials.

Thanks
jsfail.htm
calendar-usL.js
calendarL.css
0
Comment
Question by:Richard Korts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 40422727
It does get triggered. onChange event is triggered when you blur the field. in other words, make a change, and press tab. The alert will appear.

You do have JS errors on the page, but that has nothing to do with it.

Also, next time provide a link. You should not expect people to have to download your files to trouble shoot your code.
0
 

Author Comment

by:Richard Korts
ID: 40422926
To Kyle Hamilton,

It is difficult to give a link, it requires a login to a private site, I don't like to publish a logon on an open forum like this.

The fact remains, the onChange DOES NOT work. Why does not the alert, the FIRST line in the function occur?

Are you trying to say that when the change is made by the Calendar control, it is not considered a "change"?
0
 
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 40422946
you can provide a link by publishing the same three pages you posted here on a server.

i'm not sure i understand your question. are you getting the alert or no?

what browser are you using?

lets establish if you are getting the alert first, then we can move on to the actual error
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 40422961
the reference to the file was incorrect, hence the file was not found.

<script language="JavaScript" src="calendar-usL.js"></script>

I can't help you beyond that, since first, I have no idea what this is supposed to do, and second, it references external files
0
 

Author Comment

by:Richard Korts
ID: 40423035
Please look at this: http://fwsprinklercdb.info/jsfail.htm

Do not pick a tech, leave that at None.

Click on the little calendar icon to the right of the date text box; the text box should have today's date. Pick a different date (like yesterday). Note that the new date will appear in the text box. To me, that is a change that should trigger the onChange event.

But maybe it isn't recognized as such because of the calendar control.
0
 
LVL 9

Accepted Solution

by:
Brian Tao earned 500 total points
ID: 40423123
onchange occurs when the element loses focus, so:
- like what Kyle said, if you directly type into the sdate input and get out of it, the alert will pop up
- if you're using the date picker (the small calendar), since the sdate input never got the focus, the onchange event would never be triggered

Please change the first "if" statement and manually trigger the onchange event in the f_tcalHide function in you calendar_usL.js (if you haven't changed anything there, it should be at line 141 and 142) to the following:
// in function f_tcalHide (n_date), manually trigger the onchange event
	if (n_date) {
		this.e_input.value = this.f_generDate(new Date(n_date));
                this.e_input.onchange();
        }

Open in new window

and then it should work.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
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…

752 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