Käynnissä

help with javascript function that selects all options in a <select multiple> on submit

I want all the options selected when the user clicks the submit button so that in PHP i can get all the values that were in the list without the user having to highlight them.

<?php

foreach ($_POST['right'] as $selectedOption) {

echo $selectedOption."<br>";

}

?>

<script>

function selectAllOptions(obj) {

if (!hasOptions(obj)) { return; }

for (var i=0; i<[url removed, login to view]; i++) {

[url removed, login to view][i].selected = true;

}

}

</script>

<form name='dealerform' id='dealerform' method=post action='[url removed, login to view]' onsubmit='selectAllOptions(right)'>

Offices -------------------------------------------------------------------> Selected Offices<br />

<table border="0" cellpadding="3" cellspacing="0"><tr><td>

<select multiple style='width: 277px;' size="20" name="left[]">

<?php

$sql="select officeid,name from office where officeid not in (select officeid from office_dealer) order by name";

if (!$result = $mysqli->query($sql)) { echo "Error selecting offices"; exit; }

while ($row = $result->fetch_assoc()) {

echo "<option value='{$row['officeid']}'>{$row['name']}</option>";

}

?>

</select></td>

<td align="center" valign="middle">

<input type="Button" value="Add >>" style="width:100px" onClick="SelectMoveRows([url removed, login to view]['left[]'],[url removed, login to view]['right[]'])"><br><br>

<input type="Button" value="<< Remove" style="width:100px" onClick="SelectMoveRows([url removed, login to view]['right[]'],[url removed, login to view]['left[]'])"></td><td>

<select multiple style='width: 277px;' size="20" name="right[]">

</select></td></tr></table>

<br /><br /><input type='submit' tabindex=999 value='Submit'>

</form>

Taidot: HTML, Javascript, PHP

Näytä lisää: convert a psd design to html with javascript function to select and unselect all checkboxes, jquery select multiple options drop, select multiple file time folder asp net javascript, select multiple files javascript photoshop, oscommerce select multiple options, multiple select list value retain reload javascript php, submit multiple form script java javascript, call select sql javascript function, select multiple file choose file dialog javascript, select multiple category php, joomla main_menu javascript function, multiple upload progress bar javascript php, Javascript function, cartweaver multiple product options

About the Employer:
( 5 reviews ) East Peoria, United States

Projektin tunnus: #14070521

Myönnetty käyttäjälle:

ainosoft

Hi, i have read the project description, it’s perfectly match with my expertise. I believe i can do it with exact requirements within time and cost. I do not have any issue as i have done a lot of projects in Javascri Lisää

15 $ USD 0 päivässä
(35 arvostelua)
4.5

17 freelanceria on tarjonnut keskimäärin 17 $ tähän työhön

PhungTran

Hi I can do this for you. Hire me please. Thank you! .

15 $ USD 10 päivässä
(506 arvostelua)
6.9
15 $ USD 0 päivässä
(89 arvostelua)
6.4
rohitagarberg

MM. Hi, I will select all options in a select. Please let me know more about it . So that we can take things forward. Thanks.

20 $ USD 10 päivässä
(317 arvostelua)
6.5
PhpWebD

- I'm a professional developer & designer that can work with: * PHP * HTML5 * CSS3 * jQuery * Javascript * Codeiginiter * Laravel * Bootstrap * Wordpress Themes/ Plugins. * Scrapping * UI/UX * Android and Lisää

15 $ USD 1 päivässä
(57 arvostelua)
5.4
15 $ USD 0 päivässä
(91 arvostelua)
5.6
nizamulamy

Hello, How are you? I read your job with interest. I can do it. I’m an expert Web Developer with more than 5 years experiences on WODRPRESS(“Theme” and “Plugin”), CODEIGNITER, PHP, OOP, MYSQL, MYSQLI, JAVACSRICT Lisää

15 $ USD 0 päivässä
(48 arvostelua)
4.5
techsoftpk

Dear Employer; I am professional SEO friendly website designer and developer. I have 5+ years of experience with more than 100 successful projects. I would give you multiple amendments and charge less for my high Qua Lisää

15 $ USD 0 päivässä
(39 arvostelua)
4.5
phpdevelopercms

Hi, Lets discuss. I have 8 years of experience in PHP and following framework and cms i also worked on following technologies 1)Joomla 2)Wordpress 3) Smarty template engine 4) Magento 5) Drupal 6) Kohana Lisää

15 $ USD 1 päivässä
(25 arvostelua)
4.3
kishanpala

i got the issue lets discuss in chat looking forward for your reply start it immediately create milestone and award me i will give you solution

15 $ USD 1 päivässä
(18 arvostelua)
4.3
gauravgargcs

Hello, We have clearly understood your requirements and we too are willing to make some long-term clients, also we are available according to your time zone. we can do it in in hr. We have all the skills and experie Lisää

30 $ USD 1 päivässä
(14 arvostelua)
4.3
irfan811

I have dedicated the last four years to website deign and development, I have extensive knowledge with a variety of applications and web languages including Adobe applications as well as in-depth expertise in CSS3, HTM Lisää

20 $ USD 10 päivässä
(20 arvostelua)
4.3
malkaar

Please give me one chance. I am very experienced butnew in freelancing. Thanks

15 $ USD 0 päivässä
(15 arvostelua)
3.7
DhruvrajDahiya09

hello i am expert in my work i will show my work ping me and we will discuss [url removed, login to view] [url removed, login to view] [url removed, login to view] [url removed, login to view] thanks

20 $ USD 1 päivässä
(2 arvostelua)
1.4
15 $ USD 10 päivässä
(2 arvostelua)
1.1
KonstantinD84

Will do it for free just for the review_____________________________________________________________

15 $ USD 10 päivässä
(0 arvostelua)
0.0
gforgenious

I have vast experience of jQuey, PHP and HTML I can fix this issue in an hour. I have fixed many issues of this type

20 $ USD 1 päivässä
(0 arvostelua)
0.0