Solved

JavaScript Failure

Posted on 2014-11-04
6
95 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
  • 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
How to display div value on input field value in php 11 53
CSS SASS 4 34
jQuery Toggle & Anchor Links 5 43
HowTo set a global variable in javascript or jQuery 4 21
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
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 add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

840 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