473,760 Members | 9,717 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Automatically click a field

Hi,
can I have a field automatically clicked by calling something like
click()?
I have a dropdown box, one of whose elements is "Others (Please
Specify)". I list the dropdown boxes values alphabetically.
Sometimes, this value happens to be on the top and SELECTED. The problem
is that if this item is selected by clicking on it, in response to
onChange I open a text field (so user can specify the value). If this
field is automatically selected, the text field des not show; I have to
select another value then click on the "Other (please Specify)" to have
the text field visible.

Thanx.
Jul 23 '05 #1
4 1710
Ivo
"Xerxes" wrote
Hi,
can I have a field automatically clicked by calling something like
click()?
Yes. Newer browsers implement that method for a variety of elements as the
references can tellyou.
I have a dropdown box, one of whose elements is "Others (Please
Specify)". I list the dropdown boxes values alphabetically.
Sometimes, this value happens to be on the top and SELECTED. The problem
is that if this item is selected by clicking on it, in response to
onChange I open a text field (so user can specify the value).
The problem is you rely on an onchange while sometimes there is none. Create
a dummy option, with a title text and no value, on top, so that one is
selected when there is none selected.

HTH
Ivo
If this
field is automatically selected, the text field des not show; I have to
select another value then click on the "Other (please Specify)" to have
the text field visible.

Thanx.

Jul 23 '05 #2
Thanks Ivo.
The problem with creating a dummy value is that the values of the
dropdown box are set by querying a database, sorted alphabetically. If I
use something like "Select something...", it might fall somewhere in the
middle of the list of values. Any way I can get around it? Can I assign
an index (of zero) to an option?

<SELECT>
<options are filled in from a database in a php file>
< option index=0 (??)>Make a selection</option>
</select>

Thanks.

"Ivo" <no@thank.you > wrote in message
news:40******** *************** @news.wanadoo.n l...
"Xerxes" wrote
Hi,
can I have a field automatically clicked by calling something like
click()?
Yes. Newer browsers implement that method for a variety of elements as

the references can tellyou.
I have a dropdown box, one of whose elements is "Others (Please
Specify)". I list the dropdown boxes values alphabetically.
Sometimes, this value happens to be on the top and SELECTED. The problem is that if this item is selected by clicking on it, in response to
onChange I open a text field (so user can specify the value).
The problem is you rely on an onchange while sometimes there is none.

Create a dummy option, with a title text and no value, on top, so that one is
selected when there is none selected.

HTH
Ivo
If this
field is automatically selected, the text field des not show; I have to select another value then click on the "Other (please Specify)" to have the text field visible.

Thanx.


Jul 23 '05 #3
Ivo
"Xerxes" wrote
Thanks Ivo.
The problem with creating a dummy value is that the values of the
dropdown box are set by querying a database, sorted alphabetically. If I
use something like "Select something...", it might fall somewhere in the
middle of the list of values. Any way I can get around it? Can I assign
an index (of zero) to an option?


Silly you! Can't you add the first option after the sorting has taken place?
Like with line no. 2 added to your code below:

1. > <SELECT>
2. <option value="">Look Ma, no sorting.
3. > <options are filled in from a database in a php file>
4. > </select>

If you need to have the options in an PHP array before anything else, have a
look at www.php.net/array_unshift.
HTH
Ivo
Jul 23 '05 #4
Xerxes wrote:
Hi,
can I have a field automatically clicked by calling something like
click()?
I have a dropdown box, one of whose elements is "Others (Please
Specify)". I list the dropdown boxes values alphabetically.
Sometimes, this value happens to be on the top and SELECTED. The problem
is that if this item is selected by clicking on it, in response to
onChange I open a text field (so user can specify the value). If this
field is automatically selected, the text field des not show; I have to
select another value then click on the "Other (please Specify)" to have
the text field visible.

Thanx.


<script type="text/JavaScript">
function replaceOptionWi thPrompt(menu,m sg){
if(menu.selecte dIndex==menu.le ngth-1){
var x=window.prompt (msg,"");
if(x){
menu[menu.length-1]= new Option(x,x);
menu[menu.length-1].selected=true;
}
}
}
</script>

<form>
<select name="jobs" onchange="repla ceOptionWithPro mpt(this,'Pleas e
supply your job description')">
<option selected>Profes sion</option>
<option value="doc">Doc tor</option>
<option value="atty">La wyer</option>
<option value="realtor" >Real Estate</option>
<option value="other">O ther</option>
</select>
</form>

Mick
Jul 23 '05 #5

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

Similar topics

3
3819
by: paul b | last post by:
Hello, I have a small problem in PHP an perhaps someone can help me: I have a simple HTML login page with a username and a password field, as well as a submit button, which I have to use for login(I cannot simply replace it by a php-page :-(). is it possible to call this page via a hyperlink from a php-script and to directly fill the username and password fields as well to raise the event of clicking the submit button.
4
6818
by: Andy Hutchings | last post by:
Hi everybody - hope you can help out here. I have a form in a database, which is a columnar form from one of the tables in the db - there is a sub-form to the form which is a datasheet view of another table in the db. The LinkChilds property is set to show connected records from both tables. What I'd like to do is copy and paste, or use some other method of writing, the contents of one field in one table in the form, to a field in the...
1
2560
by: Curtis | last post by:
I am having a problem with the coding below that someone was trying to help me with in another website. I have been to several websites and hopefully here I can get it resolved. I inherited this database and issue, and I apologize for a bit lengthy. The coding is located in the Event Procedure on the "On Open" property of the {rptLetter}: Sub cmdPrint_Click() 'Check if no results in any field, if all missing 'inform user and exit...
1
1458
by: marksjy | last post by:
I have a small database with a primary key similar to a social security number (SSN). The tables are tied to the primary table via the SSN-type field with referential integrity. I have a number of click buttons that allow the user to navigate between screens. When I go to enter data on these forms (which use the child tables), how do I get the SSN-type field to be automatically populated upon data entry? I don't want the user to have to...
1
3502
by: namanhvu | last post by:
Hi everyone, I'm trying to create a form where the radio button is automatically selected when the input text field beside it is clicked. I know I need to use "onClick" somewhere but I don't know how. With links I found it it would work like this: <SCRIPT LANGUAGE="JavaScript"> function click(which) {
9
5180
by: Nooby | last post by:
New to Access here. I inherited a db that has the first column as an automatically generated sequential number. I want to bump it up, but for the life of me I can't figure out how to do it. Is this type of generation a built in function of Access? I'm sure it can be written manually, but I doubt someone took the trouble to do it... Can someone point me in the right direction to figure out how to change this number? Thank you one and all!...
4
2346
by: JA | last post by:
Not exactly sure how to explain this. I have 4 fields (in access 2000). Category, Catid, Subcat, subcatid. There are 40 categories, and about 1500 subcats. I've added the categories to the lookup, so when I enter them in the field, I can usually just type the first letter or two. (they are in a dropdown box). I would like to have the CatID show up automatically in it's field, after I
3
4342
by: perryche | last post by:
All, In excel, when you find a field within a spreadsheet is wrong, and every row needs to be changed, you simply change one cell, copy that cell, and select all the rest of the cell, and paste it. In word, you can just replace... in Access, how do we change fields in a table? especially if it is a check box. Say, I want all the field to be yes for a selected (or even all) records. How to accomplish this easier than export all these...
0
9521
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9333
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
9945
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...
1
9900
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7324
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
6599
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();...
1
3863
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3442
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2733
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.