Solved

JavaScript Failure

Posted on 2014-11-04
6
103 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
Suggested Courses

624 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