473,379 Members | 1,283 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

how to get the value of selected option in this code

1
here in this option transfer code.after transfering data from available _services multiple box to assigned_services multiple box i am unable to get the value of the assigned_services data for ex in this
Expand|Select|Wrap|Line Numbers
  1. <option value ="0" >Admin</option>
  2. <option value ="1" >Public</option>
i am not getting 0 and 1 but i am getting admin,public



[PHP]{php} include "header2.php"; {/php}
{literal}
<link rel="stylesheet" type="text/css" href="css/styles.css" title="rsr styles" />

<script language="javascript" src="css/statechange_min.js"></script>
<script language="javascript">

function selectAllOptions(selStr)
{
var selObj = document.getElementById(selStr);
for (var i=0; i<selObj.options.length; i++) {
selObj.options[i].selected = true;

}
}

function moveoutid()
{
var sda = document.getElementById('available_services');;
var len = sda.length;
var sda1 = document.getElementById('assigned_services');
for(var j=0; j<len; j++)
{
if(sda[j].selected)
{
var tmp = sda.options[j].text;
var tmp1 = sda.options[j].value;
sda.remove(j);
j--;
var y=document.createElement('option');
y.text=tmp;
try
{sda1.add(y,null);
}
catch(ex)
{
sda1.add(y);
}
}
}
}

function moveinid()
{
var sda = document.getElementById('available_services');
var sda1 = document.getElementById('assigned_services');
var len = sda1.length;
for(var j=0; j<len; j++)
{
if(sda1[j].selected)
{
var tmp = sda1.options[j].text;
var tmp1 = sda1.options[j].value;
sda1.remove(j);
j--;
var y=document.createElement('option');
y.text=tmp;
try
{
sda.add(y,null);
}
catch(ex){
sda.add(y);
}

}
}
}




</script>
{/literal}
<center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr>
<td width=60% valign=top>
<form name=fr1 action="?mode=createormodifyrole" method=post onsubmit="selectAllOptions('assigned_services');">
<input type=hidden name=flag value=e>
<br><br>
<center>
<table width="70%" cellpadding=8 cellspacing=0 class=bord>
<tr>
<th colspan=3>
{$msg}
</th>
</tr>
<tr>
<td><b>ROLE</td>
<td><select name="role_id">
<option value="--">--Select--</option>
{html_options options=$all_roles selected=$role_id}
</select></td>

</tr>
<tr>
<td><b>Available Services</td>
<td></td>
<td><b>Assigned Services</td>
</tr>
<tr>
<td>
<select size="6" id="available_services" name="available_services[]" rows=3 multiple>
{html_options options=$all_services selected=$service_id}
</select>
</td>
<td align="center" valign="middle">
<input type=button value="ADD" onclick="moveoutid()"></br>
<br>
<input type=button value="REMOVE" onclick="moveinid()" >
</td>
<td>
<select size="6" id="assigned_services" name="assigned_services[]" rows=3 multiple>

</select>
</td>
</tr>
<table>
<tr>
<td align=center colspan=2><input type=submit value="&nbsp;Submit&nbsp;">
</table>
</table>
{php} include "footer.php"; {/php}[/PHP]
Nov 13 '08 #1
1 7299
pbmods
5,821 Expert 4TB
Heya, vraamu.

Try removing the space character between 'value' and '='.

E.g.,
Expand|Select|Wrap|Line Numbers
  1. <option value="0">Admin</option>
  2.  
  3. <!-- instead of: -->
  4. <option value ="0">Admin</option>
  5.  
Nov 14 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: deko | last post by:
I populate a drop-down list like this: echo "<select>"; foreach ( $ip_list as $var ) { echo "<option>"; echo $var; echo "</option>"; } echo "</select>";
1
by: G Kannan | last post by:
Hey all! I have written a perl script to retrieve information from a HTML Form and insert the data into an Oracle database table. I am gettting the the following error message: "Use of...
5
by: Coz | last post by:
Hi all, I'm looking for help again!!! I have been writing a page to update a database but now have another 'silly' problem with listbox's...Grrr... I'm trying to populate the list box with...
16
by: cwizard | last post by:
I'm calling on a function from within this form, and there are values set but every time it gets called I get slammed with a run time error... document.frmKitAmount.txtTotalKitValue is null or not...
4
by: Alexandre Jaquet | last post by:
Hi, I'm looking for the shortest way to write : if (form.interface_template.options.length > 0) { template = form.interface_template.options.value } else { template = ''
4
by: Moe Sizlak | last post by:
Hi There, I am trying to return the value of a listbox control that is included as a user control, I can return the name of the control but I can't access the integer value of the selected item,...
3
by: ANTISPAM_garycnew_ANTISPAM | last post by:
What is the simplest way to retain the last option value selected in an html select object using javascript? I am currently using a server-side cgi language to accomplish this task, but it adds...
3
cassbiz
by: cassbiz | last post by:
Here is what I want to do, if possible. I have a reservation form, where one value (credit card number) needs to be run through an encryption script then get posted to the DB where all of the...
2
by: php_Boi | last post by:
i have designed an application that is a dynamic submission form. i have text fields and listboxes. now i am able to retain the values of the listboxes when i populate the listbox "manually"(single...
12
by: Doogie | last post by:
How do I make a value the default value for a combo box in ASP 3.0? What I have below does NOT work, yet I've seen it in HTML file examples before (and works if I put it in a HTML file by itself,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.