473,699 Members | 2,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10050
> 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.getEleme ntById('searchB yDateRadio').on change = function() {
if (self.checked) window.getEleme ntById('textBox ').onblur =
valiDate;
else window.getEleme ntById('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**********@g mail.com> wrote in message
news:11******** **************@ f6g2000cwb.goog legroups.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.getEleme ntById('searchB yDateRadio').on change = function() {
if (self.checked) window.getEleme ntById('textBox ').onblur =
valiDate;
else window.getEleme ntById('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
2312
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: public class MyClass {
9
39773
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 another "record" the values for all previous controls within the div are wiped out. In the javascript function where I add on to the html in the div if I capture all the data in the previous "records" then after adding the new record I can...
6
436
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 anywhere. I have managed to add Labels using the following code: Dim extralabel As Label = New Label extralabel.Text = "Generated Label" Me.Controls.Add(extralabel)
3
3146
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 expects a DataGridColumn so I instantiated an object of type TemplateColumn that I had hoped I could add a CheckBox to. I soon discovered that the ItemTemplate property of the TemplateColumn class returned an object that had implemented the...
1
3505
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 products events which I want to consume (sink) within Internet Explorer. I'm following the instructions at: ms-http://support.microsoft.com/default.aspx?kbid=313891.
4
2846
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 vendor. I'd like to be able to create schedules and lock resources for things like collision detection (two events trying to use the same resource). I've seen some GANTT charting components but I don't think that's what I'm looking for. I'd...
1
2467
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 guy's Javascript "combo box" - http://sandy.mcarthur.org/javascript/select/select.html. It allows my users (when I get some!) to select from a list of preexisting options and also to add a new one by clicking on "add new". Essentially it's a select...
5
4464
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 2 questions 1. Is it possible to identify all the files in the resource file during runtime by name of the file? 2. Is it possible to add files to a project at build time to make an exe with those files? Thanks.
6
1970
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 when I transfer the info I get this error. The server encountered an unexpected condition which prevented it from fulfilling the request. The script had an error or it did not produce any output. If there was an error, you should be able to see...
0
8613
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9172
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8880
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7745
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6532
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.