I have two list box (A and B), and I have two buttons to move list
items (options)
from this box to the other.I have a submit button to submit the form.
I know how to move items from A to B by using Javascript, and I know
how to use <option ... selectedto select an item.
However, how can I select an item after the page is rendered? In other
words, A and B have been populated with data and the page is rendered.
I click the move items button to move other items from A to B. I want
all items in B are selected.
Thanks, 3 3118
On Tue, 11 Dec 2007 18:27:27 +0100, Ming <mi*******@gmai l.comwrote:
I have two list box (A and B), and I have two buttons to move list
items (options)
from this box to the other.I have a submit button to submit the form.
I know how to move items from A to B by using Javascript, and I know
how to use <option ... selectedto select an item.
However, how can I select an item after the page is rendered? In other
words, A and B have been populated with data and the page is rendered.
I click the move items button to move other items from A to B. I want
all items in B are selected.
=comp.lang.java script
Just select it just after you add the it to the b <selectwith
javascript. Alternatively, just select every item in B in the onsubmit()
action of your form. Be very, very aware offcourse this will break all
functionality for those without javascript.
--
Rik Wasmus
"Ming" <mi*******@gmai l.comwrote in message
news:ba******** *************** ***********@s19 g2000prg.google groups.com...
>I have two list box (A and B), and I have two buttons to move list
items (options)
from this box to the other.I have a submit button to submit the form.
I know how to move items from A to B by using Javascript, and I know
how to use <option ... selectedto select an item.
However, how can I select an item after the page is rendered? In other
words, A and B have been populated with data and the page is rendered.
I click the move items button to move other items from A to B. I want
all items in B are selected.
simplest break-down i could think of...
<?
$items = isset($_REQUEST['items']) ?
$_REQUEST['items'] :
array();
$myItems['A List'][] = 'Hello';
$myItems['A List'][] = 'World';
$myItems['B List'][] = 'B';
?>
<form method="post">
<?
foreach ($myItems as $type =$defined)
{
foreach ($defined as $index =$item)
{
$selected = isset($items[$type][$index]) ? 'checked' : '';
?>
<input name="items[<?= $type ?>][<?= $index ?>]"
type="checkbox"
value="<?= $item ?>"
<?= $selected ?>
> <? = $item ?>
<br>
<?
}
}
?>
<input type="submit" value="Save And Refresh">
</form>
"Steve" <no****@example .comwrote in message
news:e7******** *****@newsfe05. lga...
>
"Ming" <mi*******@gmai l.comwrote in message
news:ba******** *************** ***********@s19 g2000prg.google groups.com...
>>I have two list box (A and B), and I have two buttons to move list items (options) from this box to the other.I have a submit button to submit the form.
I know how to move items from A to B by using Javascript, and I know how to use <option ... selectedto select an item.
However, how can I select an item after the page is rendered? In other words, A and B have been populated with data and the page is rendered. I click the move items button to move other items from A to B. I want all items in B are selected.
simplest break-down i could think of...
<?
$items = isset($_REQUEST['items']) ?
$_REQUEST['items'] :
array();
$myItems['A List'][] = 'Hello';
$myItems['A List'][] = 'World';
$myItems['B List'][] = 'B';
two things...first, based on your description, subtract the submitted items
from your default lists...
$myItems['A List'] = array_diff_asso c($myItems['A List']);
$myItems['B List'] = array_diff_asso c($myItems['B List']);
second, change the original same to be options of a list box rather than
just the check boxes. ah screw it...give me a second to repost the answer. i
should have read your post better to begin with! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kevin Lyons |
last post by:
Hello,
I am trying to get my select options (courses) passed correctly from
the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html
I am having difficulty getting the courses to pass the correct option
value and then be displayed at the following URL:
http://www.dslextreme.com/users/kevinlyons/selectResults.html
I am passing countries, products, and courses. The first two display
|
by: TJ Walls |
last post by:
Hello All,
Is it possible to create a <select> element with no selected options? I
have tried setting the selectedIndex attribute to -1, but as far as I can
tell this only works for <select multiple> elements.
Am I missing something obvious?
Sincerely,
TJ Walls
|
by: john woo |
last post by:
Hi
Please see the following simple script:
<TD align="Left" width="30%" >
<select name="DEPARTMENT" SIZE ="1" style="width:200px;"
onChange="Change()">
<option value="0"> <ALL>
<option value="1000012" >Food Sales
<option value="1000014" >Dessert Sales
|
by: BrianP |
last post by:
Hi,
I have had to invent a work-around to get past what looks like a
JavaScript bug, the malfunctioning Perl-like JavaScript array functions
including SPLICE() and UNSHIFT().
I have boiled it down to a very simple test case which can be
cut-n-pasted into a .html file and viewed in a browser:
============================================================================
|
by: RC |
last post by:
I can't quite grasp the concept of creating custom reports depending
upon what options a user picks on a Form. For example, the user
clicks on a "Print Reports" button and a Form pops up. On the Form
the user can choose to get a report that shows the Box Numbers that
are at Warehouse A, Warehouse B or Warehouse C. and then click on the
Print Preview button and get a report showing only the Box Numbers in
whichever warehouse was...
| |
by: Matt Kruse |
last post by:
Using the latest version of Opera 8.5, this test case:
--------------------------------------------------------
<select name="sel" multiple="true" size="3">
<option value="option1" selected>option1</option>
<option value="option2" selected>option2</option>
<option value="option3" selected>option3</option>
</select>
<input type="button"
|
by: DBoy001 |
last post by:
Hi !
I have a problem with Internet Explorer that I really can't explain.
If anyone can find a solution to this, I congratulate you...
I'm trying to have a script dynamically select all (or some) of the
options in a select field. It won't work, it will only select one
option at a time...
While I was trying to debug, I realized that if I put an alert before
|
by: teknoshock |
last post by:
I have created a page with multiple drop down boxes, all populated with
the same options. My problem is, for 12 dropdown boxes and 40 choices
per box, I end up with a massive file. Also, if I want to change or
add options to a drop down box, I then have to copy that to the other
11 boxes. Would it be possible to define the options once, and then
have all of the drop down boxes get their options from the single list?
Here is my...
|
by: gtrDayve |
last post by:
Recently I ran all my Windows Updates which included many for Visual
Studio 2005, & now when I open VS05 (using ASP.NET, VB.NET), all my
toolbox options are grayed out except for the Data options; which
include: DataSet, DataGridView, BindingSource, etc.
This means that Label, Textbox, button, etc are all unavailable. My
"General" option in Toolbox states "There are no useable controls in
this group." I can run apps ok, & if I copy a...
|
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...
|
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,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
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...
| |