473,320 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Coldfusion & Javascript

Hello,

I have date fields on a form which is generated by a Coldfusion custom
tag (another piece of code). I want to change something else on the
form when the user changes the date. But, how do I generate an
onChange() event on this field (since I only have the call to the
custom tag in this form)?

Thanks in advance for any suggestions.

Jnag

Mar 21 '07 #1
4 2084
"jnag" <pr******@gmail.comwrote in news:1174505780.987236.193340
@l77g2000hsb.googlegroups.com:
Hello,

I have date fields on a form which is generated by a Coldfusion custom
tag (another piece of code). I want to change something else on the
form when the user changes the date. But, how do I generate an
onChange() event on this field (since I only have the call to the
custom tag in this form)?

Thanks in advance for any suggestions.
Try this JS (note: execute this line *after* the form has loaded):

document.forms['TheFormName'].elements['TheDateFieldName'].onclick =
whatYouWantToDo;
Mar 21 '07 #2
Jim Land said the following on 3/21/2007 5:10 PM:
"jnag" <pr******@gmail.comwrote in news:1174505780.987236.193340
@l77g2000hsb.googlegroups.com:
>Hello,

I have date fields on a form which is generated by a Coldfusion custom
tag (another piece of code). I want to change something else on the
form when the user changes the date. But, how do I generate an
onChange() event on this field (since I only have the call to the
custom tag in this form)?

Thanks in advance for any suggestions.

Try this JS (note: execute this line *after* the form has loaded):

document.forms['TheFormName'].elements['TheDateFieldName'].onclick =
whatYouWantToDo;
It would seem to be a better idea to use the onload event of the window
to trigger a function to set it. Then you know, for sure, that it is
available for scripting.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 21 '07 #3
On Mar 21, 5:10 pm, Jim Land <rrrrfffftttt(no)@(spam)hotmail.com>
wrote:
"jnag" <prajy...@gmail.comwrote in news:1174505780.987236.193340
@l77g2000hsb.googlegroups.com:
Hello,
I have date fields on a form which is generated by a Coldfusion custom
tag (another piece of code). I want to change something else on the
form when the user changes the date. But, how do I generate an
onChange() event on this field (since I only have the call to the
custom tag in this form)?
Thanks in advance for any suggestions.

Try this JS (note: execute this line *after* the form has loaded):

document.forms['TheFormName'].elements['TheDateFieldName'].onclick =
whatYouWantToDo;
Thank you very much for this suggestion. It works partially (in that,
before I was not able to even fire the event). But, it is implementing
the event function before the form comes up. I want it to happen when
the user changes the date. I have included this line after the
<form...tag just where the date field tag is defined. Is this
probably because the date field is part of the server side custom tag
which has already been executed? Thanks.

Mar 22 '07 #4
"jnag" <pr******@gmail.comwrote in news:1174573152.118201.37600
@l75g2000hse.googlegroups.com:
On Mar 21, 5:10 pm, Jim Land <rrrrfffftttt(no)@(spam)hotmail.com>
wrote:
>"jnag" <prajy...@gmail.comwrote in news:1174505780.987236.193340
@l77g2000hsb.googlegroups.com:
I have date fields on a form which is generated by a Coldfusion
custom
tag (another piece of code). I want to change something else on the
form when the user changes the date. But, how do I generate an
onChange() event on this field (since I only have the call to the
custom tag in this form)?
>Try this JS (note: execute this line *after* the form has loaded):

document.forms['TheFormName'].elements['TheDateFieldName'].onclick =
whatYouWantToDo;

Thank you very much for this suggestion. It works partially (in that,
before I was not able to even fire the event). But, it is implementing
the event function before the form comes up. I want it to happen when
the user changes the date. I have included this line after the
<form...tag just where the date field tag is defined. Is this
probably because the date field is part of the server side custom tag
which has already been executed? Thanks.
I think you need to put the onclick line of code much later in the page.
Try just above the /html tag at the end of the page. Or, as Randy
suggested, put it in the body onload event. By then the form will be
completely loaded and any changes the user makes will trigger your
onclick event.

Mar 23 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: entact | last post by:
I've got a simple coldfusion query output (title, id and disclaimer) that I use to dynamically populate a select box with the title using the id as the value. What I need is to use javascript to...
4
by: johkar | last post by:
When the output method is set to xml, even though I have CDATA around my JavaScript, the operaters of && and < are converted to XML character entities which causes errors in my JavaScript. I know...
2
by: am_pcguy | last post by:
I have a web based application for my company. We use Coldfusion, I wanted to see if I could use Javascript to make the page a bit more dynamic. Right now I use the command: <cfhttp...
7
acoder
by: acoder | last post by:
This page will link to a number of tutorials. Coldfusion Language Coldfusion Variables Using Coldfusion Variables Coldfusion Image Gallery How to upload a file in Coldfusion How to send...
3
by: jnag | last post by:
Hello, I have a website with various font options (small to large) buttons that the user can click on the banner, which runs through the site. Site contains both static and dynamic content. I...
1
by: jnag | last post by:
Hello, I have implemented styleswitcher.js on my coldfusion website. The code looks perfectly ok, but the stylesheets are not taking effect. Basically, nothing changes when I click on the...
7
by: kmitchell00 | last post by:
I am coding in Coldfusion MX7 and using Javascript for some of the functionality. The basic functionality I'm coding is, based on a value the user chooses from a dropdown box, I populate address...
2
by: quest007 | last post by:
Hi! I have configured IIS for coldfusion and when I access my coldfusion site through localhost, the pages are served as required. But if i ty to access it from a remote machine by specifying the IP...
106
by: bonneylake | last post by:
Hey Everyone, Well i don't know if my question should be in javascript/ajax or coldfusion, i figure this is more of a coldfusion question. But if this is in the wrong section let me know an all...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.