Menu Populates Based On Select Field Entry?

Aug 10, 2011

I am looking to build as basic as possible, a form that has 3 select dropdowns that have predetermined options. The user will select the first option and based on that option the second will populate and based on that, the third one will give the last option. Now, when the last one is selected, i need a div or a paragraph displaying information to be displayed.So here's the framework.

Option 1 = fruit or vegitables of which fruit is selected is selected by the user
Option 2 = Apples, Grapes, and pears of which apples is then selected
Option 3 = Red, Green and Yellow of which Green is selected.

Once green is selected, I need a description about the green aple to be displayed.

View 7 Replies


ADVERTISEMENT

Menu Selection Populates Text Field

May 1, 2009

I have the following code I picked up which tries to fill in a text field with data depending on a user's menu item selection. I place this code in the header:

Code:
var colors = new Array();
colors["apple"] = "red";
colors["grape"] = "purple";
colors["milk"] = "white";
colors["cheese"] = "yellow";
colors["chicken"] = "white";
colors["beef"] = "red"; .....

var groups = new Array();
groups["apple"] = "fruit";
groups["grape"] = "fruit";
groups["milk"] = "diary";
groups["cheese"] = "diary";
groups["chicken"] = "meat";
groups["beef"] = "meat";

function printColorAndGroup(){
var value = document.getElementByName('food').options[document.getElementByName('food').selectedIndex].value;
document.getElementByName('food_group').value = groups[text];
document.getElementByName('food_color').value = colors[text];
}

I then use the following html in the body:
Code:
Food:
<select name="food" onchange="printColorAndGroup()">
<option>apple</option>
<option>grape</option>
<option>milk</option>
<option>cheese</option>
<option>chicken</option>
<option>beef</option>
</select>

Group:
<input type="text" name="food_group">
Color:
<input type="text" name="food_color">
But when I run this nothing happens...
Here's the page [URL]. None of the code above is colored... looks like I'm using the wrong tags here. Which tags should I use to post this stuff correctly?

View 12 Replies View Related

Create A Text Field And Populates It With A Current Date

Mar 15, 2011

I am working with multiple PDF documents. I am able to add a text field to the bottom of my doc's on the last page and upon Print, write 'document expires on "current date"' The text is only visible in print and the date is always current. I need to aply this to over 100 documents on the center bottom of the last page only. And I haven't a clue how to do this in a batch. I have done this so far using the Advanced, document processing.

View 3 Replies View Related

TagName With SELECT - Populates The Row And Creates New Elements In Each Cell - New Selects - Inputs - Textareas

Mar 24, 2010

I got a table with some select, inputs and textareas in it. if i click a button i execute addRow function which populates the row and creates new elements in each cell (new selects, inputs, textareas). But i dont know why, when i get a child of TD where select is the tagName is undefined and nodeName is #text, for INPUT and TEXTAREA it works perfect.

Some code

Code:

It happen so in Chrome and FF, in IE works fine (first time something that works here and doesnt in ff)

View 3 Replies View Related

Disable Text Field Based On Dropdown Menu Selection

Feb 18, 2009

I have a simple form - I want to disable the text field if Choice 2 from the dropdown menu is selected. I have this working with the code below, but for some reason if I go back and select choice 1 after selecting choice 2 the text field remains disabled. I only want it to be disabled if choice 2 is selected.

View 5 Replies View Related

Populate Form Field Based On Select Option?

Jan 14, 2009

Is there some example js that shows how to populate a text field on a form, based upon what option is chosen in a select form field? The options can be hardcoded and it would be great to also have a default if js is off on the client side.code...

View 4 Replies View Related

Get Option Menu To Auto-select Based On URL Parameter?

Mar 5, 2009

I want a page to have a different item pre-selected in an option menu-button according to the parameter at the end of the URL. Eg if the URL ends in "?choice=Beta", the item that says "Beta" should be pre-selected. Here's what I have so far:

Code:
<script type="text/javascript">
function show(choice) {

[code]....

View 4 Replies View Related

Validate Correct Entry In A Field As Well As It Can Accept Empty Field?

Feb 9, 2011

that a javascript which is validating a phone number accepts only digits but if the text field is left empty it should accept the entry as an empty entry...

View 2 Replies View Related

Setting Multiple Text Field Values Based On Select Choices?

Jan 13, 2009

I'm trying to do something that is slightly complex and I can't find any relevant examples in the usual places,I'm pulling a list of projects (and their IDs) into a select:

Code:
<select name="proj_id" id="proj_id" onchange='setValuz()'>
<option value="1" >1st Project</option>
<option value="2" >2nd Project</option>
</select>

Each project has two associated values, in addition to the unique ID:

[Code]...

Can anyone shed some light on how I could do this? Maybe a link to a "how-to" (if there is one out there)?

View 3 Replies View Related

Build A Redirect Url Dynamically Based On 2 Select Field Combinations Chosen?

Oct 8, 2009

I am having trouble writing this javascript for my work, normally I would do this in ASP or PHP, but the environment I am working with will only allow javascript for dynamic function.

The form has two different select boxes and based on your options selected for select box #1 and select box #2, the hidden input field "redirect" (which is currently empty) would then populate dynamically with the URL associated with that combination mentioned below. The hidden redirect input field (now containing dyanmically generated data) would then pass the new value via HTTP_POST to .net script that will handle the redirect processing step fed to it. code...

View 5 Replies View Related

Pass Select Menu Results To A Form Field?

Feb 18, 2009

I am developing a small app in Joomla! where I need to sequentially number file folders. On the page where I add new folders I have a select menu to select the type of folder. In this case, either Action, Reference, or Archive. What I want to have happen is after I select the type of folder, I want to enter the next available number in the form field. I realize to do this without resubmitting the page I need to use javascript and onchange. The problem is I am almost clueless when it comes to javascript (I am working on it though) so I need some help. This is what I have.

Code:

<fieldset class="adminform">
<legend><?php echo JText::_( 'Folders' ); ?></legend>
<table class="admintable">

[code]...

I assume I have to pass my php array into a javascript array then call that based on my select menu. Only I have no clue how to go about doing that.

View 2 Replies View Related

Redirecting To URL Based On User Entry In Form?

Apr 17, 2011

I'm trying to create a form where the user enters data in a field and is redirected to a URL based on that entry - example: user enters 1234 and he is directed to mypage.com/1234/index.htm - if that folder does not exist it would give a 'try again' error.

View 18 Replies View Related

Update Selected Option Based On Another Entry

Sep 30, 2011

I have an options list that is generated from a database. It currently has ~125 options in it. I've received the request that the user be able to either enter the corresponding number or select the option from the list. How can I update the "selected" attribute in the options list based on a number that may be entered in another text entry box?

View 4 Replies View Related

JQuery :: Way To Add Entry To Menu

Jan 31, 2011

<div data-role="content">
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">
<li data-role="list-divider">Menu</li>
<li><a href="docs/test.html">Test1</a></li>
</ul>
</div>

imagen i have this simple menu. And i have a mysql database with a table menu. And in this table there are 5 entries that goes Test1...Test5. And i get them by php. How can i add those entries to my menu?

View 1 Replies View Related

Ajax :: Request - Populate A Form With Information From A Database Based On A Textbox Entry

Jun 29, 2011

I'm trying to populate a form with information from a database based on a textbox entry. However, when I begin to key in the textbox I receive "undefined" in each textbox throughout the form.

Take a look at my code for any errors? It also appears that my $_GET['jobid'] is not working properly.

And here is my php:

View 2 Replies View Related

JQuery :: Adding Entry To Menu?

Feb 12, 2011

<div data-role="content">
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">
<li data-role="list-divider">Menu</li>
<li><a href="docs/test.html">Test1</a></li>
</ul>
</div>

i have this simple menu. And i have a mysql database with a table menu . And in this table there are 5 entries that goes Test1...Test5. And i get them by php. How can i add those entries to my menu?

View 1 Replies View Related

Click Button To Add Entry To A Text Field?

Aug 13, 2010

I wish to have my form update a text field when a 'add' link or button is clicked, allow for more entries to be added without having the page refresh. but i need to be able to have both the friends name and their number added to the field like so

if friends name is say 'jason' and their number is '0987654321' then it will add to the textarea like so.

jason [0987654321] this way i should be able to get the data and split it up when the form is send so i can add them in the DB. the part i am stuck on is how to get both fields in the textarea. allowing for more to be added without a refresh. can anyone suggest how they might do this.

[Code]..

View 4 Replies View Related

How To Update Selection List Contents From A Server Database Based Upon User Data Entry

Jul 23, 2005

I am trying to create a web page in which the contents of one selection list
depends upon which element in another selection list is chosen, but where
the information to populate the first selection list comves from an SQL
database on the web server.

There are a couple of these situations in my application but, for example,
the first list might be a list of counties, and the second list a list of
states/provinces. Obviously the names of counties depend upon which
state/province is chosen, but there are too many possibilities to be able to
embed them within the web page itself. So when the user selects a
state/province I need to go to the server to ask for the list of counties.

I have seen a number of posts that sort of address this issue. For example
it is suggested to use <script src="a URL"/> to ask the server side code to
send up data of type "text/javascript". However the examples do not seem to
address how the server side code would know which state/province the user
had selected.

If there is a web site that addresses this sort of thing, I would appreciate
any pointers.

View 5 Replies View Related

Append Extra Text To Form Field Entry

Jan 2, 2010

I am trying to find a way to add an extra piece of hidden text onto the end of the text a user enters into the form field so that when the form is sent the extra text will automatically be added to the end before sending. I have tried cobbling together different scripts using onblur/onclick etc but I just cannot get any to work as I need..

View 1 Replies View Related

Erasing Entry And Associated Hidden Field With Delete Button

Nov 5, 2010

I'm trying to think of the best way to do this, and have it be browser-friendly (Read: Runs in IE, FF, Chrome, and optimally Safari too, but the last one isn't necessary). User selects an item in a dropdown list. Clicks the Add button. A new entry inside a DIV appears, which consists of a hidden form field, the entry name, and a Del button. When the delete button, I need it to erase that entry (and the associated hidden field) but not the whole block.

View 1 Replies View Related

Using Javascript To Select An Entry In A Drop Down Box

Jul 23, 2005

I have a dropdown box containing about 10 values.

I would like to create a separate href on my page that when clicked will
make the drop down box go to a specific value. I do not want to have to
refresh the page to do this. Is it possible to have that sort of control
over a drop down box.?

View 5 Replies View Related

Select A Random Entry From An Array?

Aug 30, 2010

So, I am attempting to select a random entry from an array, and then make it so that particular entry will not be selected again until every entry has been selected. Basically, I don't want to see any of the same entries, until all of the entries in the array have been selected.

So if this were my array....

keywords =
[
"ppc",
"games",

[Code]....

since meta was selected a second time before everything had been selected once.

I would like to see something more like

meta, advertise, gaming,ppc, welcome, home, games, advertise, ppc, since this did not select any entry multiple times before every entry had been randomly selected.( the second loop started at the second "advertise" in case you didn't catch the differences.

But as you can see from the code that I have posted above, I do not know how to do this. I have seen examples where the entries that were randomly selected, were actually deleted from the array entirely but this is not what I want to do. I just want every entry to be selected once, and then for the process to be restarted.

View 3 Replies View Related

JQuery :: Open An Entry In An Accordion Menu Using A Link?

Feb 17, 2011

i have a website where i have on the left side a button menu and on the right side an accordion menu. how can i get it to work, that when a user clicks on a button in the left menu, the associated entry in the accordion menu will open?

View 1 Replies View Related

JQuery :: Validation Plugin - Optional Field For User Entry

Oct 21, 2010

In a registration form middleName field is optional. When the users enters his/her middleName, then it should validate that field. I have used the following code to achieve the above scenario, but it is not working.

$("#middleName").rules("add", {checkName: true, required: false, messages: {checkName: "Please enter a valid middle name"} });
jQuery.validator.addMethod("checkName",
function(value, element) {
var regExp = new RegExp(/^[a-zA-Z0-9s|,|.|-|']+$/);
return regExp.test(value);
},
"Please enter a valid name."
);
How to achieve the above scenario.

View 1 Replies View Related

JQuery :: (.) Period In Value Field - Show/hide A Div Based Based On The Selection Made Via A Dropdown

Apr 9, 2010

Im using a jQuery script to show/hide a div based based on the selection made via a dropdown.

<script type="text/javascript" src="jquery-1.3.2.min.js"></script>

The problem im having is that the value used in the dropdown lists are price values eg 10.00

Consequently jQuery seems to interprit these as css notations, meaning the code doesnt work.

View 4 Replies View Related

DropDown List - User Can Select More Than One Entry

Mar 20, 2010

I am having a problem where I want to give user an option to select more entry from one dropdown.

Example:
<form name="form1" method="post" action="">
<label>
<select name="service" id="service">
<option value="service1">service 1</option>
<option value="service2">service2</option>
<option value="service3">service3</option>
<option value="service4">service 4</option>
<option value="service5">srvice5</option>
<option value="service6">service 6</option>
</select>
</label>
</form>

In this case, I want to select service 3, service 4, service 5 and service 6. I don't know how to create a javascript function for this.

View 1 Replies View Related







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