473,327 Members | 2,016 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,327 software developers and data experts.

show/hide text field from select(dropdown)

What I am trying to do is add first text field right after a dropdown menu only if the user selects a first option, when a user selects second option then second text field is opened

I am new to java script so pls help me.....
Apr 7 '11 #1
4 2709
Frinavale
9,735 Expert Mod 8TB
Could you please provide us more details about what you have tried so far to solve this problem.

Do you have any JavaScript implemented at all to solve this problem?

Are you having problems generating the JavaScript?

If you have tried implementing a JavaScript solution for this application, and you are experiencing problems...what are the error messages that you are getting?

Considering using JavaScript debugging tools that come built into IE8/9, Safari, or Chrome. If you are using FireFox, then consider downloading Firebug: an application that allows you to debug CSS and JavaScript problems.

-Frinny
Apr 7 '11 #2
Shenno
59
basic javascript methods of access html tags is :

had to give id to each element u wanna access (read or write) then use document.getElementById('id')

this will return the object u wanna access..

to insert value to <div> use innerHTML='value'

to get value from text fileld use .value

to inser value to text field use .value='value'

hope this helps.
Apr 8 '11 #3
hi, i am new to java script and php also. so if you kindly give me the details, it will help me.

thanks..
Apr 8 '11 #4
Frinavale
9,735 Expert Mod 8TB
PHP runs on a web server and is used to dynamically generate HTML that is sent to the web browser to display to the end user.

JavaScript runs within the web browser and allows you to modify things client-side while the user is using the web page.

Without JavaScript you would have to send a request to the server (to the PHP code) so that it could generate HTML based on the user's actions. JavaScript is faster and uses less bandwidth than posting back to the server....however JavaScript can't do everything (for example it can't connect to a database)

As Shenno was saying, JavaScript has a document.getElementById() method that allows you to access an HTML element on the page. This method accepts a parameter: the ID of the HTML element that you want to work with.

So this means that your PHP script has to generate unique IDs for each HTML element that it generates...well, at least for the HTML elements that you need access to in your JavaScript code.

Please note that ID's for HTML elements must be unique on the page. Be aware of this when you are looping or you are calling other PHP scripts to help generate the code.

To get started, you may want to check out the Offsite JavaScript Links thread that is sticky in the JavaScript forum.
Apr 12 '11 #5

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

Similar topics

6
by: Steve Speirs | last post by:
Hi I'm trying to show/hide a simple piece of text and a text field on a form based on what choice is made from a drop down box. <select name="dropdown" size="1"> <option selected...
20
by: Dannyboyo | last post by:
I have what I hope is a simple request. I can't really code in javascript, but I am pretty good at cusomizing it with slight modifications. I code in ASP and HTML. I am trying to capture customer...
8
by: Lyn | last post by:
Hi, Can anyone tell me how the initial value displayed in Combo Box is determined when a form is opened? I am loading the dropdown from one field ("CategoryName") of a table, with "ORDER BY ". ...
2
by: Monty | last post by:
I use a SELECT dropdown as the nav interface for jumping to a chosen page number. When I setup up the SELECT element on the page, I want to show the user the current page number they are on, so, I...
2
by: Wolfgang | last post by:
Hi, is there a possibility to change the size of the select-dropdown-box ? I predefine the length of the option-area with 10 inside HTML as follows: <select class="select250"...
5
by: =?Utf-8?B?bWNhdWxpZmZl?= | last post by:
I have an old application ( pre-VB5) that I need to add a select/option list to. This is an edit program so the values for the form will be retrieved from a database. How do I set the value of...
1
by: nubianqnn | last post by:
Hello All, I am stumped on a function to show/hide drop down elements based on a user's selection. If a user selects a second item from the first dropdown list, then I want to show a related...
4
by: nubianqnn | last post by:
I am stumped on a function to show/hide drop down elements based on a user's selection. If a user selects a second item from the first dropdown list, then I want to show a related dropdown with two...
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: 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: 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...
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)...
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: 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...

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.