473,378 Members | 1,207 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,378 software developers and data experts.

How do I recognize a button push from a different field

110 100+
I probably didn't ask the question right; but, I have a webpage where agents are entering information about trucks they want insured. I want to break out of a function when a button push occurs.

As agents are entering units, the first thing we ask for is the model year. This signals the beginning of a new entry. However, when they are finished with vehicle entry they can push a button called "Done with Units." When this occurs I want to break out of the first function and go to the function triggered by the button.

In other words each field, like the model year, has a function that handles the information received in that field. I want the direction of the program to change if and when the Done with Units button is pushed. How can I recognize that? Is it an "else if?" And, if so, how do I code it?
Aug 18 '09 #1
5 2688
Dormilich
8,658 Expert Mod 8TB
as long as the function runs there’s little to do… (maybe except when you check inside the function) but as it seems, it should be enough to break up the function (btw., what does the function do?) in smaller parts, so that you can “break” after each part.
Aug 18 '09 #2
andersond
110 100+
Each field has a function that does one thing or another and is called by the onblur event. In most all cases the first thing the function will do is see if the field is blank. In some cases the function will test to verify that the entry was all digits, in the case of a model year, or take the contents of the field, strip it of illegal characters then format it as dollars and cents. There are only a small number of questions asked about each vehicle. For example, I will ask for the model year, the body style, the make and the current value. In most cases the user will push the "Done with Units" button when focus is on the model year field; but, it is not unthinkable that it could occur on a different field. I just don't know how to do an "else if" a button is pushed.
Aug 18 '09 #3
Dormilich
8,658 Expert Mod 8TB
I think you don’t need to check the button while any of the onblur() functions is working (time is too short). after the onblur() the JS is “idle” (waiting for the next action). if in the meantime the button is pushed, it will create a new event/action where you can (de)activate or trigger whatever you want.
Aug 18 '09 #4
andersond
110 100+
Right.

Let's try this again. My onblur function checks for a valid entry in a given field. My button's function redirects action from that field to a new task. As it is, the onblur function redirects focus to the field that was left empty. So, I have to enter bogus information until I find a field or a place in the execution of the program where nothing is check for validity. I want to have an option in the validity checker that will break out of checking the field and redirect the program to do something else. As it is, the program allows the entry of up to 12 vehicles and 12 drivers. If the applicant only has one vehicle and one driver I don't want the user to have to enter bogus information for 11 that don't actually exist. If this was not Javascript I would attempt to capture the last keystroke (pushing the "Done with Vehicles" button) as an option in my onblur function. Let me rephrase my question. Is there a Javascript command/function that captures the last keystroke?
Aug 19 '09 #5
Dormilich
8,658 Expert Mod 8TB
basically you have to remove the onblur() events from the input fields. Yet I’m not sure* whether the onclick() event of the button is triggered, because you’re stuck in a blur-focus-loop until bogus information is passed. maybe you have to substitute the onblur() event by some other (maybe an onblur() of the <fieldset>).

* - this would have to be tested

[EDIT]
another idea, why don’t you start with one “unit” and let the user decide (via ‘add car’ button) whether he wants to do more?
Aug 19 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Elliot Temple | last post by:
How do I make Python press a button on a webpage? I looked at urllib, but I only see how to open a URL with that. I searched google but no luck. For example, google has a button <input...
4
by: Paul | last post by:
Hello, I tried to execute a button on an aspx webpage using WebRequest, but it failed. When posting data as if I did a login (see code), I just receive the login page, instead of the page I...
1
by: Johan Nedin | last post by:
Hello! I am having a problem with the @OutputCache page directive and Web browser Back Buttons. Problem: After setting <%@ OutputCache Location="None" %> on my pages I get the "Warning!...
10
by: william | last post by:
Hi, I have a datagrid, inside there is a templete item, it's button. I want to do some thing when user click the button, but do not want the postback event happens. How can I do it? Thanks. ...
29
by: Tom wilson | last post by:
I can't believe this is such an impossibility... I have an asp.net page. It accepts data through on form fields and includes a submit button. The page loads up and you fill out some stuff. ...
3
by: aaa | last post by:
I am unable to get a my popup to recognize a hidden field on the calling page. I have this working on a different page although that page is a tad simpler. The page I am trying now calls from a...
3
by: Patrick [MSFT] | last post by:
Let me preface this with the goal I'm trying to achieve is mimic a feature of another language (Dexterity used by Microsoft Dynamics) and so while a filling a drop down list is a workable solution...
7
by: Bjorn Sagbakken | last post by:
Hello. There maybe an simple answer to this, but sometimes one get a strange blindness when working intensely on one single problem. I'm using ASP.NET 2003, building pages that include 3 user...
4
by: John | last post by:
I have a form with 5 buttons, each of them executing code and showing a different report. I would like to add a 6th button 'total' that opens all 5 reports in a row (next report opens when other is...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.