Populate A Second DropDownList Based On A Selected Value From Other DropDownList


Jun 23, 2010

I'm trying to link two dropdownlist depending on the value you select from the first dropdownlist. What I want to do is select a value from the first dropdownlist and depending on its value show some options in the second dropdownlist. I try doing this:

1-when the OnChange event of the first dropdownlist occurs, I call a javascript that redirects to a method in a controller (for example: index/mainController/firstMethod/selectedValue).

2-the method in the controller using the url helper extracts the “selectedValue” to do a database search of the value of the second dropdownlist.

3-the same method loads the view (the one that have the ddl)

Doing this I lose the selected value of the first ddl. I think this is not the right way to do it.

View 2 Replies


ADVERTISEMENT

Populate A Dropdownlist Based On The Selection Made In Another Dropdownlist?

How do I automatically populate the second dropdown based on the selection made in the first one. Say if I choose a contry in the first dropdown, then I want to display a list of cities from that country in the second dropdown. Is there a way to do this with jQuery?

View 1 Replies

Change Dropdownlist To Textbox And Viceversa Based On Another Dropdownlist?

I am developing an application where I am using country (dropdown list) and state (dropdown list).The question is when 1 select country, it's states will be populated in state dropdownlist but the state list is only provided for USA and other countries are not provided so they have to type in.

So how to change state input type (TEXTBOX OR DROPDOWNLIST) based on USA (country).That is If USA -DROPDOWNLIST Else Other Countries -TEXTBOX

View 5 Replies

Get Dynamically Second Dropdownlist Based On First Dropdownlist?

i have a form. In this i want display the category names in one select box. Based on the selection of category if the category is having sub-category then it will show the second select box dynamically for a respective category. This is based on the category value not based on the index they select..

View 3 Replies

Populate Textbox With Multiple Items From A Dropdownlist?

what i want to do is to select multiple data from a dropdownlist and place it on a textbox.. and it will be done whenever the user clicks a data from the dropdownlist.

it really does work. the next thing i would like to do is to insert into the database everything that were chosen that were moved to List2[] using queries with PHP and Mysql..

View 3 Replies

Use The Value Of A Selected Value From A DropDownList Populated With AJAX / It?

I have form with two dropdownlists (lets say A and B). When I select a value from A, B is being populated accordingly using AJAX In the same page I have a button, that when pressed, posts the values of the selected items of the dropdownlists to another PHP page. The problem I am having is that the selected value of B is returned as Blank/Empty. Is there a way to store the selected value of a dropdownlist populated using AJAX?

(Main FORM)
<form name="NewBar" method="post" onsubmit="return validateFormOnSubmit(this)" action="AssignContactDetailToBar_f.php">
<tr>
<td width="150"><b>Bar:</b></td>
<td>
<select name = "bar" onChange="getContact('AssignContactDetailToBar_f_getContacts.php?bar='+this.value)" size = 1 style = "width:190px">
[Code]...

View 1 Replies

Javascript - Dynamic Dropdownlist And POST Selected Value

I am writing the following in PHP:i would like to have 2 dropdownlists, where the second one is populated from a mySQL dB according to the choice made on the first dropdown list. Then I would like to use the values of the selected values of the dropdownlist to call another PHP page in which I will generate a db query.

Eg:
List A: Car Manufactures (honda, nissan, etc)
List B: Models (accord, civic, etc)

View 3 Replies

Linking Database Selected Through Dropdownlist With Mysql?

linking database selected through dropdownlist with corresponding database in mysql via php

View 2 Replies

Code To Link Database Selected Through Dropdownlist With Mysql?

code to link database selected through dropdownlist with corresponding database in mysql.Plz reply as soon as possible.Dropdownlist will list all database names inserted in a particular table

View 4 Replies

Keeping Lastly Selected Value From A Dropdownlist After Button Click

Just like the title says i'm having difficulties in achieving it. Here's my dropdownlist:

<?php
$query = "SELECT data, rel_id FROM $tbl_rel_balansas INNER JOIN $tbl_balansas ON $tbl_rel_balansas.rel_id = $tbl_balansas.id WHERE $tbl_rel_balansas.member_id = '$_SESSION[id]' group by data";
$result = mysql_query ($query);
echo "<select name=data value=''>Data</option>";
while($nt=mysql_fetch_array($result)){
echo "<option value=$nt[data] name="blabla">$nt[data]</option>";
}
[Code]....

Here's the buttonclick:

[Code]....

After I press it, it retrieves the data I want from the date I've chosen from the drop down list and also reset whole drop down list showing the first value of the dates from sql database, not the one I selected. If anyone knows how to keep the selected value in the list

View 1 Replies

Dropdownlist - Implement Language Packs Based On User Selection

I created 3 language packs for my site: English, Spanish and French. I am just having trouble implementing them based on user selection. I have the following drop down menu:

<select onchange='document.location.href=this.options[this.selectedIndex].value;'>
<option>Select</option>
<option value="?lang=eng">US English</option>
<option value="?lang=esp">Español</option>
<option value="?lang=fra">Français</option>
</select>

How can I include the language files based on what the user selects, I just don't know what to put as the condition in the if statement.

View 2 Replies

Get Dropdownlist Text Value?

i have a problem to dropdown list, i have use this url coding [URL] (download link --ajax dd) this process use two dropdownlist boxes, my problem is i want insert dropdownlist text only,but here they use get value...
how to get dropdownlist text value.

excname = dfgdg
$cat = 2(cat ddlist)-----i need text value only what to do.
$subcat = ICWA(subcat ddlist)

View 1 Replies

Dropdownlist With The Use Of Ajax?

I have 1 drop down on top of the page , and in that list the items are - today , last week.Now according to that list item-value , below that drop down list records should be displayed from the database.

dummy code
if today
then
records with current date should be displayed

View 1 Replies

Get Dropdownlist Select Option Value?

In my dropdownlist I have two different values for each option. How can I retrieve both? Let me illustrate what I mean.

<select name="my_ddl">
<option value="<?php $value_Id ?>"><?php $value_text ?></option>
<option value="<?php $value_Id ?>"><?php $value_text ?></option>
</select>

When the form is posted, I want to be able to get both the $value_id and $value_text of the selected option. How can I do this?

$_POST['my_ddl'] only gets one value not both.

In asp.net I could do this simply by referring to my_ddl.Value and my_ddl.Text.

View 4 Replies

Dropdownlist Get Dropdown Value And Text?

<select id="animal" name="animal">
<option value="0">--Select Animal--</option>
<option value="1">Cat</option>
[code]....

I have a dropdown like this. What I want, I want to get selected value and text in button submit using PHP.I mean if it's selected 1st one. I want to get both 1 and Ca

View 3 Replies

Dropdownlist Filter By User?

ive got list of reports. for default, the report list will be showing all reports without filtering. when drop down filter click, it will filter the result by name. anyidea how to fix it?

function getReportSingleMonth($month, $year, $id_user=NULL) {
$month = $db->real_escape_string($month);
[code]....

View 3 Replies

Give All DropDownList The Same Width?

I need to give all dropDownList in _form and _search the same width. How can I do that?

View 1 Replies

Dropdownlist - Create A Drop Down On A Webpage?

I wanted to create static and a dynamic drop down for an online application form on my web page The static drop down would a list of clearance levels where the dynamic one would be based on a list of job openings (which is in turn taken from a folder that has 1 pdf file for each job opening) the end goal is that an email would be sent to our hr director with the applicants info. and the fields in the body of the email.

View 2 Replies

Get Data From 2 Dropdownlist After Submitting The Form?

Ive been searching around here to find an answer but I cannot find one :). My issue I have 2 dropdownlist "manufacturers" and "models". This is for an aircraft directory. What I want is after the user select a manufacturer and model and click "submit", they will be redirected to a page and show the information about a certain aircraft that belongs to that certain manufacturer and model. Just for clarification, I want to show that data after the user click the submit button. I saw a lot of tutorials about getting data from the dropdownlist but all of them used "onchange" for getting and displaying the value from the dropdownlist.

here is the code:

<form name="psform" action="pistonsingle.php" method="post">
<?php
$display = displaymaincat(1);
while($result=mysql_fetch_array($display)){
echo $result['maincategory'];
}
?>
<?php

[Code]...

its working. it displays the data but the problem is when the user click the submit button even he/she select a certain manufacturer or model, what my code do is just display all the aircrafts and not a certain aircraft that belong to a certain manufacturer and model.

View 1 Replies

Html - Have A Working Dropdownlist With Links From A Csv?

I have a website that loads a CSV, divides it into parts, and shows these parts. There are 7 parts, and since it is for a music store it is sliced like this:

the name of the product
the subname
the price
the stock in one shop
the stock of the other shop
the group name
the brandname

What i have now is that it shows 12 products on 1 page, with a next and previous link on top of the page. The pages are made with the group name, every group has it's own page, so you have a drums page, guitar page, speaker page. That all works great. What i programmed in there is a dropdownlist, it drops down a list of brandnames, which should narrow the search for a person who is looking at the products. Problem is right now, that the dropdown menu works, i see the brands, but they are NONE clickable, only the brands that are currently on the page are shown, so NOT all the brands from that group are shown, only the 12 that are currently showing, when you press next, it shows 12 more brands, but i want them to be shown right on the start.

And the third problem is, when it is showing the brands, it shows them double or triple, depending on how many products have the same brand. Is there a way what i want, with this code as a basis ?

[Code]....

View 2 Replies

Dynamic Data Population Using Html Dropdownlist Control?

PHP i have problem in dynamically populate data over two dropdownlistbox.first dropdownlistbox contain areacode and second dropdownlistbox shows corresponding data for the first dropdownlistbox without submitting the form.

View 1 Replies

Ajax Dropdownlist - Show Feb Month As A Leap Year?

I am working on a php ajax dropdownlist.What i am trying,When a user select january month it show 31 days similarly in march 31,april 30,may 31 n december.in feb month it should take leap year.

View 2 Replies

Multiple Dropdownlist Size - Display Only The <select Value> With The Dropdown Arrow

I have a dropdownlist that pulls data from an sql table. I am having trouble displaying it. I want to display only the <select value> with the dropdown arrow. If I set the size to 1, it doesn't give me a dropdown arrow. It only displays <select value>. If I set the size to 2. It displays the <select value> and the second value, but also no dropdown arrow. Only if I set the size to 3 or higher does it show the dropdownarrow with the displayed 3.

echo "<select name="$strNameField" size="1" multiple="multiple">";

View 4 Replies

Auto Populate Based On Dropdown Selected?

How can I auto populate the data from db by dropdown selected?and my dropdown result already appear as well, the code as following:

<?php
[code].........

View 1 Replies

Using Javascript To Populate A Number Of Text Boxes Based On The Data Item Selected In The 1st Combo Box?

I am using javascript to populate a number of text boxes based on the data item selected in the 1st combo box. I am now working on making the selection of that combo box populate another combo box with items from another table. I can hard the sql code for the 2nd combo box so that when I select an option it populates more text boxes, but want the contents of the 2nd combo box to dynamically change depending on the selection of the 1st box. I would like this to do it without refreshing the page after each 1st combo box selection.any help would be massively appreciated as I been stuck on this for a while. The 2nd box does not populate with the below code as I guess the variable isn't populated, I can put '1' in and it selects products with that prodid, but as explained above i'd like it to read the prodid from the 1st combo box.

<?php
require "session_logincheck.php";
function selectProductAndPopulate()

[code]...

View 3 Replies

Load View Passing Two Arrays To Specific More Dropdownlist In One View?

I have two drop downlist in one view but i don't know if i can load the view passing the two arrays like this:$this->load->view('primerPaso',$data,$data2);
To be more specific i'm doing everything like this:
Model
/*
* Método encargado de consultar las ciudades
* donde existen agencias.
*/
function ConsultarCiudadesAgencias()
{
$this->db->select('LISValor');
$this->db->from('410LIS');
$this->db->where('LISNombre','ESTLista3');

[code]...

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved