Solved

JavaScript Failure

Posted on 2014-11-04
6
86 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 25

Expert Comment

by:Kyle Hamilton
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now