Javascript With Php Select Box

Apr 13, 2003

its about redirection using javascript when the select box is being invoke onChange command is being change it should be able to redirect that page dynamically~~ tq
PHP Code:
<?php

echo "<select name="navi" ONCHANGE="submit();">";
echo "<option value=&#391;'>hi</option>";
echo "<option value=&#392;'>hoi</option>";
echo "</select>";

echo "<script language='JavaScript'>";
echo "function submit(){";
echo "if(document.document1.navi.options[0].selected){";
echo "window.location='seek_data.php'}";
echo "}"; //if
echo "</script>";
?>

View 2 Replies


ADVERTISEMENT

Javascript In Select Box

Oct 6, 2004

I am really crazy on my javascript because I don't know what is the error about it (the red line). The purpose is that when select the value from "tradetermno" select box, then shows the related list in the second select box "tradetermdetailno".

<FORM action="somewhere" method="POST" name="contractform">
...
...
<SELECT size="1" name="tradetermno" document.contractform.tradetermno.options[document.contractform.tradetermno.selectedIndex].value)">
<OPTION value="1" SELECTED>FOB </OPTION>
<OPTION value="2">C&F </OPTION>
</SELECT>
<SELECT size="1" name="tradetermsremarkno">
</SELECT>
...
...
</FORM>
...
...

The error the IE shown is "Object expected". Would anyone tell me what's wrong of my code?

View 3 Replies View Related

How Can I Search A Select Tag With JavaScript

May 24, 2005

Does any of you know how to create a drop-down list that allows the user to search the drop-down list using two characters, that is, the user will click on two characters of the keyboard which will be the first two characters of the word they are searching for in the list, which will be match to the first two characters of the the first word that has those two characters first.
For instance, we are use to searching in a drop-down list using one character which matches to the first letter of the word first word in the list in alphabetic order.

Now, what I am looking for is to search with two characters; which will match with the first two letters of the words in the list in alphabetic order.

View 13 Replies View Related

<SELECT> Javascript Alternative

Mar 29, 2006

I am currently recoding my website to perform more efficiently. By performing more efficiently I mean that I will be recoding the server side mostly.

One Particular idea I had was for select boxes. Right now for a page that lists the information for a user (say country of birth for example, which has over 200 option values) the php has to print all the values of the countries in a loop as <option></option>. The reason why it has to print them out each time is because it has to select the users country name.

Considering that there are 200+ values and there are also about 8 other select boxes that also have their information to be selected and printed thru php loop, it can get to be quite a strain on the CPU (when a bunch of users are all doing it).

So I decided to use a javascript function for each box to select the correct option value to be selected according to what the user has chosen beforehand. It generally is the same thing only the client is doing the job and not the webserver.

So what I am asking here is that should I reply on the javascript to do this? I have the paranoia that there will be some occurances where the client doens't have javascript or the version of javascript wont support the DOM features that are used to perform the job.

So for the average browser to be doing something like this, should I still be worried about this or should I go back to using the server side to handle the selected box values???

View 2 Replies View Related

Javascript Focus And Select

Jul 28, 2007

<head>
<body>
<td width="346"><table width="346" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="63" height="5" valign="top" class="myWebEmbedNURLFont">&nbsp;&nbsp;URL</td>
<td id="urlForm" width="283" align="left" valign="top"><input name="embedCode" type="text" value="testingtestingtestingtestingtestingtestingtestingtestingtestingtestingt estingtesting" class="myWebEmbedNURLInputFont" size="47" onClick="javascript:document.urlForm.embedCode.focus();document.urlForm.embedC ode.select();" readonly="true"></td>
</tr>
</td></body>

a very draft code, what i wanna do is when i click on the form, the value will auto be selected. but i cant seem to do so, and i am not very sure of the problem.

View 3 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

Javascript Use <option> From <select> As Control

Jan 20, 2006

i tried to create a dropdown menu and use the option as a control to
change content inside another text area

the code is like this:

<select name="xxxx"><option onclick="changeunitprice(29.87)"
value="1744"/>

the function changeunitprice() is called when an option is selected

problem is it works well with firefox but not IE

any ideas? or is there anyway can make same effect in IE?

View 1 Replies View Related

Javascript Multiple Select Menu

Aug 1, 2006

iam creating a multiselect menu in javascript the code for that is as follows:

"<select id="groups" name="groups[]" size="4" multiple>"
"<option value=x>xyz</option>"
..
..
..
..
"</select>"

iam doing this completely in javascript. Its a dynamic menu. So how can
retrieve the values in javascript itself .

View 1 Replies View Related

Javascript Select Text On Mouseover

Feb 6, 2007

I want to be able to select a word when I highlight over any part of
the word. When I say select the word, I want it to be highlighted as
if I left clicked my mouse and dragged the cursor along the word. I
want to do this so a user when putting the mouse over the word can
quickly hit <ctrl>c to copy the word, without having to manually
highlight the word.

This will be used multiple times in the script for specific words, not
for every word in the script. For example:

User Password
------- ---------------
admin adminUser
dba sysDbAPa$$

So in my above example when mousing over either of the passwords, the
entire password would be highlighted so I can quickly copy it.

View 3 Replies View Related

Iterating Comboboxes (<SELECT>) Using Javascript

Oct 15, 2007

I have a page that dynamically draws checkboxes with a combo. I'm
then attempting to use the following code to iterate through each combo
box and change the value to match the text box. Code:

View 1 Replies View Related

Selecting Values In A Select Box Through Javascript

Sep 16, 2006

I've searched everywhere for this but can't find it. How can I select a particular value in a select dropdown box using javascript? (I.E a select box has 5 values, how can I select the 3rd?)

View 1 Replies View Related

Javascript Option/Select Box Validation?

May 29, 2002

Is it possible to check an option/select box to see if it still has data in it? I'd like to be able to stop a user from updating a file IF the field they are copying from still has content in it. I.e.

BOX 1 BOX 2
1 3
4
6
2
5

So the button will display an error message (e.g. you aint sent the entire lot over)

I've tried to attempt it but my mind cannot really handle anything more than (Check kettle for water, IF water equal or less than 1 cup full, then fill kettle with water, If kettle equal to or greater than 3 then STOP).

View 3 Replies View Related

Preventing File Save Or Select-all In Javascript?

Jul 3, 2006

I want to protect the data on my web page ; I want to make it viewing-only.

I've already disabled right-click, but can I take it one step further, and disable certain pulldown menus like copy, select-all, or file-save-as?

View 7 Replies View Related

Update All Select Boxes On Page Using Javascript

Jan 25, 2007

I am trying to update all Select boxes on a page dynamically using
javascript, I simple want to change the selected item in each select
box when a tick box is pressed on the page. Each Select box is named
in the same convention ie. ddl_DeliveryStatus_ and then the recordID
and contains the same options in the same order. The number of select
boxes changes every time the page is loaded as this is all built using
ASP linked to a database.

I am hoping there is an array or collection or something similar I can
simply reference to do this, but an struggling to find the answer.

View 2 Replies View Related

Populating An HTML Select From A JavaScript Function

Dec 12, 2005

How would I go about simply populating an HTML select statement from a JavaScript function. You see I have several HTML select statements on one page which are identical (sometimes repeated multiple times) so I wanted to try and cut down on these multiple instances and just have the values hard coded once (in a JavaScript function perhaps) and then called whenever they are needed. Could anyone advice me please, would this be easy to do?

I have the following HTML select statement hard coded:

<select name="bodyFontType">
<option value="">Select Font</option>
<option value="Verdana">Verdana</option>
<option value="Arial">Arial</option>
<option value="Tahoma">Tahoma</option>
<option value="Trebuchet MS">Trebuchet MS</option>
</select>

Would I use an onLoad property on the select statement to call a function which creates an array and then pushes through the values?

View 2 Replies View Related

Javascript Question On Dynamic Select Boxes

Jan 28, 2002

Question: How hard is the following to do in javascript and does anyone have a good example of this in use (aka how do you do it? )

4 drop down boxes all on one page. I have 4 items in the list of the first drop down box.

Red
Blue
Green
Orange

When I select one, I want the choice to be taken out of the list for the second drop down box. So if I select Blue in Drop Down #1, Drop Down #2 now has the option of

Red
Green
Orange

If I select Red from the list the Drop Down #3 now has

Green
Orange


Then if i select Orange, the last drop down has only one value and that is Green.

View 5 Replies View Related

Javascript Changing The Options Of The Second Select Box Depending On The First

Oct 17, 2007

I have two text boxes one with months in "January, Febuary..." but as not every month has the same ammount of days i need the second select box to change to instead of having options 1-30 it has 1-28 or what ever depending on what month is selected.

View 1 Replies View Related

JQuery :: Select All / Select None *text* Links In A Form That Call A Jquery Function To Select All Or Select No Checkboxes?

Jun 16, 2011

I've seen a variety of implementations around that enable selecting all or no checkboxes by using a checkbox to toggle that choice. However, I'm trying to find a way like this: I have two text links on my page: Select All, and Select None. How can I get those links to call a jquery function to select all or select no checkboxes in my form? As a little food for thought:

<head>
$(function() {
//function for selecting all or none...is there a way to make a single function that passes in a parameter to differentiate between selecting all or selecting none, or do I need a separate function for both?[code]....

View 2 Replies View Related

Multiple Select Boxes :: Make The Select Boxes Appear AFTER You Select The Field Before?

Jul 24, 2009

<script language="JavaScript" type="text/javascript">
<!--
/*[code]....

// This script supports an unlimited number of linked combo boxed

// Their id must be "combo_0", "combo_1", "combo_2" etc.

// Here you have to put the data that will fill the combo boxes

// ie. data_2_1 will be the first option in the second combo box

// when the first combo box has the second option selected

// first combo box

data_1 = new Option("Business Cards", "$");
data_2 = new Option("Club Flyers", "$$");[code].....

I have this code, and I was wondering if it is possible to make the select boxes appear AFTER you select the field before.

View 8 Replies View Related

Pass Text From One Select Box To Another Select Box Using The For Loop To Check The Existence Of An Item But It Is Not Working?

Aug 28, 2010

i am trying to pass text from one select box to another select box. The logic is if 10 are added, no more passing must happen. Also if an item is already added, it mustn't be added again.I am using the for loop to check the existence of an item but it is not working: what am i doing wrong?

Code:
function PassSelectValues(){
//pass values from select boxes to select boxes
var counter;[code]....

why isn't counter incrementing at all? The alert message box does appear saying item exists but the item gets added anyway.

View 1 Replies View Related

Disable Select Until User Puts Mark In Check Box. Then Enable Select?

Jun 26, 2010

disable select until user puts mark in check box. Then enable select.I have two select box's on a page. The first asks what product, the second is based on the first and presents a list of pdf's according to which product the user selected. (yes, multi dimensional)What I have works fine, but now i need to make the user put a check mark in a check box before the First SELECT box becomes enabled/available.So basically, when they agree, they can get the download.Here are my select boxes.

HTML Code:
<form>
<select name="category" style="width:180px"></select>
<select name="site" style="width:180px" onchange="openLink(this.value)"></select>[code]....

(ignore the The 'open' button. It's there in case the default option is what the user wants, so they don't have reselect via the select box.)

1. How do I disable the select boxes by default on page load?

2. How do I detect that the user has put a tick in and the enable the disabled Select box?

View 6 Replies View Related

Ajax :: PHP Select Jquery - Make The Select Change Based On What Is In The Databse

Jun 17, 2011

I have a php function that list all of the countries from my database as a select option, then based on what the user selects for their country im using jquery to make an ajax call and get all of the states/regions for that country. This part works fine. I'm running into an issues, as when a user login's in to edit their profile, how would I make the select change based on what is in the databse.

[Code]....

View 3 Replies View Related

Expected '' Error - Select Menu 'Customer' Which Triggers A 3 JS Functions - To Populate 2 Extra Select Menus

Aug 18, 2010

I'm having problems with a Javascript 'Lookup' function.

Basically, I have a select menu 'Customer' which triggers a 3 JS functions, to populate 2 extra select menus.

Using IE Developer Tools, during debugging, I get this error: Expected ';' Error

This relates to either: eval(ajax_CustContact[index].response); OR eval(ajax_CostCentreContact[index].response); (it's a bit random, as sometimes it works, sometimes it doesn't)

I have tried changing the 'custid' to 'custname' to check whether it was an integer causing the problem, but had the same problem.

View 4 Replies View Related

JQuery :: Auto-select A Select Box On Postback With User's Selection

Feb 12, 2010

I have a ColdFusion page with a select drop down list. On submit, I'm storing the value in a cfparam and trying to use jQuery to auto select that particular option. Currently I'm using :contains but this is unacceptable because it selects the last item that contains the cfparam.

$("option:contains('<cfoutput>#form.company_type#</cfoutput>')").attr('selected', 'selected');
Is there something like this:
$("option").equals('<cfoutput>#form.company_type#</cfoutput>')").attr('selected', 'selected');

[Code]....

I willconsider other alternatives to accomplishing my objective.

View 1 Replies View Related

JQuery :: Select Change > Remove An Item From The Select Field?

Mar 19, 2011

What I try to do is the following..let's say I have this form:

<select name="sSelectMe" class="someclass">
<option value="">select an option</option>
<option value="1">option 1</option>

[code]....

View 1 Replies View Related

Get A Select Box To Display Text From A Database In A Div Tag From The Select Box Populated By A While Loop

Jan 21, 2011

I'm trying to get a select box to display text from a database in a div tag from the select box populated by a while loop that also pulls from the database. The only way I can do this is from a javascript written by sending it over to a second page and I need it on just one page. Here is my code below:

<?php
session_start();
$q=$_GET["q"];
$num = $_GET['num'];
$test = $_GET['oneGram1'];
$_SESSION['oneGram']=$test;
[Code]...

Even if this is a wrong way to go about doing this can someone post just a simple script using a select box and displaying data on the same page?

View 9 Replies View Related







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