473,320 Members | 2,029 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.

adding events to an input box at runtime

HI all,

I have a form for searches on a mysql database/table. The form has on input
text box, and several pushbuttons. Depending on which pushbutton is
selected, the search is then done on a specific field. One of them isa date
field.
How can I add or change the onfocus, onblur events of the input box to one
that is relevant to the type of search being done. For example, I have some
date format and valadation function, I would like to change the inputs
onblur and onkeyup to functions specific for date, and then when region
pushbutton is selected to change those same events to one spevific for
region
Can thin be done, if not what are the alternatives.

Thanks
Robert
Jun 6 '06 #1
2 10020
> I have a form for searches on a mysql database/table. The form has on input
text box, and several pushbuttons. Depending on which pushbutton is
selected, the search is then done on a specific field. One of them isa date
field.
How can I add or change the onfocus, onblur events of the input box to one
that is relevant to the type of search being done. For example, I have some
date format and valadation function, I would like to change the inputs
onblur and onkeyup to functions specific for date, and then when region
pushbutton is selected to change those same events to one spevific for
region
Can thin be done, if not what are the alternatives.


I am not sure I understand your problem. What I think you are asking is
if you can do something like:
window.onload = function() {
window.getElementById('searchByDateRadio').onchang e = function() {
if (self.checked) window.getElementById('textBox').onblur =
valiDate;
else window.getElementById('textBox').onblur = null;
}
}

(Please excuse that I haven't tested this code, and it could be cleaned
up quite a bit)

If this is not what you are looking for, please give us some kind of
URL where we can see what you are trying to do.

Jun 6 '06 #2
Hi Josie,

I think you have understood half, or maybe more presise I explained half
What you have done in the onload event is exactly what I am looking for, but
when a user his/her select to the date radiobutton.
This once the page has already loaded.
It is initially set to have the claimno radiobutton set, and the inputbox
accepts char, the onblur is set to a cleanchar funtion
Now when the user changes to the date radiobutton, the onblur event should
be set to a dateformat function
The example you gave, would this achieve what I am trying to do??

Hope you understand more clearly now

Thanks
Robert

"Joshie Surber" <jo**********@gmail.com> wrote in message
news:11**********************@f6g2000cwb.googlegro ups.com...
I have a form for searches on a mysql database/table. The form has on input text box, and several pushbuttons. Depending on which pushbutton is
selected, the search is then done on a specific field. One of them isa date field.
How can I add or change the onfocus, onblur events of the input box to one that is relevant to the type of search being done. For example, I have some date format and valadation function, I would like to change the inputs
onblur and onkeyup to functions specific for date, and then when region
pushbutton is selected to change those same events to one spevific for
region
Can thin be done, if not what are the alternatives.


I am not sure I understand your problem. What I think you are asking is
if you can do something like:
window.onload = function() {
window.getElementById('searchByDateRadio').onchang e = function() {
if (self.checked) window.getElementById('textBox').onblur =
valiDate;
else window.getElementById('textBox').onblur = null;
}
}

(Please excuse that I haven't tested this code, and it could be cleaned
up quite a bit)

If this is not what you are looking for, please give us some kind of
URL where we can see what you are trying to do.

Jun 6 '06 #3

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

Similar topics

2
by: manohar.shankar | last post by:
Hi, I have been searching on this topic for quite sometime and didnt get any answer. Is there a way I can extend/add methods/properties to a C# class during runtime. eg., I have class:...
9
by: Michelle | last post by:
I have a div that is initially empty. Clicking on a button will add some text boxes and other controls so the user can add additional records. In IE all works fine but in Netscape 7.0 when I add...
6
by: Nathan Sokalski | last post by:
I am trying to dynamically add controls to my page, but am having trouble with controls such as buttons. I have been able to add simple controls such as Label controls, because they can be placed...
3
by: Fao, Sean | last post by:
I have a DataGrid that I'm adding CheckBox controls to at runtime (in the code behind) and I'm not sure if I'm doing it correctly. First of all, I noticed that the MyDataGrid.Columns.Add() method...
1
by: Apu Nahasapeemapetilon | last post by:
Hello and thank you in advance for your help. Can anyone think of a reason why this code would work properly on one PC, but not another? I've got a System.Windows.Forms.UserControl that...
4
by: Dinsdale | last post by:
I'm looking at adding scheduling features to an application and I wanted to ask the community about any experience with scheduling components, either open source like from code project or from a...
1
by: The Eclectic Electric | last post by:
I'd be very grateful if anyone could help me with this. From my limited knowledge of Javascript I don't think it is possible, but I'll punt anyway. I downloaded and very slightly adapted this...
5
by: DBC User | last post by:
I have a situation, where I need to add 4 or 5 data files (they change every time I build) in my project during build time and somehow I need a way to access these files during runtime. So I have...
6
nomad
by: nomad | last post by:
Hello Everyone: I'm having troubles with some coding and Idon't know where it is. I have delevopled a calender where the client can add events to a day. The code worked perfect on my computer but...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.