Adding select box in CFgrid
Hi,
like datagrid in dotnet,is it possible to add selectbox in cfgrid and also capturing events of selectbox.
Advance Thanks,
not sure about capturing events, but here's a
sample bit of code for adding select drop-down:
<!--- sample select, i.e.drop-down box --->
<cfgridcolumn name="Fee" header="Fee" select="yes" values="10,15,20,25" valuesdisplay="10,15,20,25">
hope that helps.
Similar Messages
-
ColdFusion 11, hot fix 3 installed but did not help. There are no binds.
This one has been driving me crazy and I have finally figured out that it is the first column in each grid where there is a select box via "valuesdisplay" that is the issue. Select box results are switching grids!
Example of how it is coded to display:
Grid 1 - gridcolumn should have a dropdown with 1,2,3
Grid 2 - gridcolumn should have a dropdown with a,b,c
Grid 3 - gridcolumn should have a dropdown with x,y,z
However, the results in the dropdowns in the grids are:
Grid 1 - x,y,z (should be 1,2,3)
Grid 2 - 1,2,3 (should be a,b,c)
Grid 3 - a,b,c (should be x,y,z)
This only happens with the first dropdown for each grid. Any other columns with dropdowns do not have any issues and do not swap out to the wrong grid.
Sample of my code from the grids:
Grid 1:
<cfgrid name = "evalgrid"
height="200"
autowidth="no"
font="arial" fontsize="12"
query = "getevalfinal"
SORT="Yes"
selectmode="edit"
format="html"
insert="yes"
delete = "#deletevalue#">
<CFGRIDCOLUMN NAME="numberofschools" HEADER="numberofschools"
HEADERALIGN="LEFT" DATAALIGN="LEFT"
BOLD="Yes" ITALIC="No"
SELECT="Yes" DISPLAY="Yes"
HEADERBOLD="Yes" HEADERITALIC="No"
VALUES = " ,NA,1,2,D"
VALUESdisplay = "Blank,NA,1,2,D" valuesDelimiter=","
width=50>
</cfgrid>
Second Grid:'
<cfgrid name = "SecondGrid"
height="100" width="700"
font="arial" fontsize="12"
query = "getsecurity"
SORT="Yes"
selectmode="edit"
format="html"
insert="yes"
delete = "#deletevalue#"
autowidth="yes"
>
<CFGRIDCOLUMN NAME="userrole" HEADER="userrole"
HEADERALIGN="LEFT" DATAALIGN="LEFT"
BOLD="Yes" ITALIC="No"
SELECT="Yes" DISPLAY="Yes"
HEADERBOLD="YES" HEADERITALIC="No"
VALUES = "#olduserrole#"
VALUESdisplay = "#olduserrole#" valuesDelimiter=","
WIDTH=300
font="arial" fontsize="12">
</cfgrid>
In the above code, userrole values end up being in the wrong grid where numberofschools values should be and vice versa.
Appreciate any help!
B.You may find this article useful: [http://balusc.blogspot.com/2007/10/populate-child-menus.html].
-
Adding the Country List in Select Box
Hi Gurus
How to add the Country List in the Select box, which are avilable in CRM system.
If u have any pointers please provide me
Regards
SatishHi satish,
What i understood from your question. You have to make your country group in customizing in crm, follow the path IMG->CRM->E-COMMERCE->E-SELLING define country groups.
Then you have to assign this country group to you shop.
Hope it helps you.
Regards,
sap-crm -
Two select box in a form in JSP...Save me...Please
Hi,
My jsp page has one form with two different select/option. One select is fbox and another is tbox. tbox contains master values from db and fbox contanis some/few/no values from db.(It might be empty.) Now, I want to add a value from tbox to fbox. If that value is already in fbox then ALERT otherwise add in that value in fbox. Following is the code for that.
Would somebody help me out ? I don't know what's wrong with this code. It's not working............It's kind of serious and urgent.
function add(fbox,tbox) {
var i = 0;
if(fbox.value != "") {
var no = new Option();
for(var i=0; i < tbox.options.length; i++)
if((fbox.value == tbox.options.value) || (fbox.value == tbox.options[i].text))
alert("Value is already added. Select another item.");
break;
else
no.value = fbox.value;
no.text = fbox.value;
tbox.options[tbox.options.length] = no;
fbox.value = "";
else
alert("Please enter an item.");Hi Srinath or anybody,
Would u pl. tell me what's wrong with following code ? Javascript prompt is not invoking....U can see/find javascript function addservice(service) in my code which is called by JSP code inside in my form...
I am using Tomcat 3.3, Jdeveloper 3.2, IE 6.0 and Netscape 7.0.
I am badly working on this but Javascript prompt is not working....
Thanks for ur time and help...
Waiting for ur reply.
David
<%@ page contentType="text/html;charset=WINDOWS-1252"%>
<%@page language= "java" import= "java.sql.*,sun.jdbc.rowset.*,javax.servlet.http.*,java.lang.reflect.*,java.io.*,java.util.*,javax.servlet.*"
errorPage="error.jsp" %>
<jsp:useBean id="conn" class="package1.connectionBean" scope="session"/>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1252">
<META NAME="GENERATOR" CONTENT="Oracle JDeveloper">
</HEAD><center>
<BODY>
<script language="javascript" SRC="FormChek.js"></script>
<script language="javascript">
function CheckFstock(ftock) {
var Gooddigit = "0123456789";
if (document.formtest.ftock.value.length > 3 )
alert('Invalid Stock ! Please re-enter with less than equal to 3 digits.');
return false;
}// if ends
function CheckPostal(postal) {
var valid = 1;
var GoodChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var Gooddigit = "0123456789";
var Goodextrs = "- ";
var i = 0;
if (document.formtest.postal.value == "")
// Return false if number is empty or length is not 7 length is not 6
alert('Invalid Postal Code ! Please re-enter now.');
valid = 0;
document.formtest.postal.focus();
return false;
}//if ends
else if(document.formtest.postal.value.length == 7)
//alert (GoodChars.indexOf(document.formtest.postal.value.charAt(0)));
for (i =0; i <= document.formtest.postal.value.length; i++)
//alert( i + "->"+ document.formtest.postal.value.charAt(0))
if ((GoodChars.indexOf(document.formtest.postal.value.charAt(0)) == -1) || (GoodChars.indexOf(document.formtest.postal.value.charAt(2)) == -1) || (GoodChars.indexOf(document.formtest.postal.value.charAt(5)) == -1))
alert("Not Valid Chacters in entered Postal Code! Please re-enter now.");
valid = 0;
document.formtest.postal.focus();
return false;
} // if ends
if ((Gooddigit.indexOf(document.formtest.postal.value.charAt(1)) == -1) || (Gooddigit.indexOf(document.formtest.postal.value.charAt(4)) == -1) || (Gooddigit.indexOf(document.formtest.postal.value.charAt(6)) == -1))
alert("Not Valid digits in entered Postal Code! Please re-enter now.");
valid = 0;
document.formtest.postal.focus();
return false;
} // if ends
if (Goodextrs.indexOf(document.formtest.postal.value.charAt(3)) == -1)
alert("Not Valid extras in entered Postal Code! Please re-enter now.");
valid = 0;
document.formtest.postal.focus();
return false;
} // if ends
} // for ends
}// else if ends
else if(document.formtest.postal.value.length == 6)
for (i =0; i <= document.formtest.postal.value.length; i++)
if ((GoodChars.indexOf(document.formtest.postal.value.charAt(0)) == -1) || (GoodChars.indexOf(document.formtest.postal.value.charAt(2)) == -1) || (GoodChars.indexOf(document.formtest.postal.value.charAt(4)) == -1))
alert("Not Valid Chacters in entered Postal Code! Please re-enter now.");
valid = 0;
document.formtest.postal.focus();
return false;
} // if ends
if ((Gooddigit.indexOf(document.formtest.postal.value.charAt(1)) == -1) && (Gooddigit.indexOf(document.formtest.postal.value.charAt(3)) == -1) && (Gooddigit.indexOf(document.formtest.postal.value.charAt(5)) == -1))
alert("Not Valid digits in entered Postal Code! Please re-enter now.");
valid = 0;
document.formtest.postal.focus();
return false;
} // if ends
} // for ends
}// else if ends
else { alert('Postalcode is not 7 or 6 charactres long ! Please re-enter now.');
document.formtest.postal.focus();
}//else ends
return valid
}//this function ends
function goback() {
history.go(-1);
function addItem(fbox,tbox)
var boxLength = tbox.length;
var selectedItem = document.formtest.list1.selectedIndex;
var selectedText = fbox.options[selectedItem].text;
var selectedValue =fbox.options[selectedItem].value;
var j;
var isNew = true;
//alert('BOx Length is : ' + boxLength);
if (boxLength != 0)
for (j = 0; j < boxLength; j++)
thisitem = tbox.options[j].text;
if (thisitem == selectedText)
isNew = false;
alert("Selected value is already available. Please select a different item");
break;
if (isNew)
newoption = new Option(selectedText, selectedValue, false, false);
tbox.options[boxLength] = newoption;
fbox.selectedIndex=-1;
function remove(box) {
if (confirm("Are you sure you want to delete. Continue?")) {
for(var i=0; i<box.options.length; i++) {
if(box.options.selected && box.options[i] != "") {
box.options[i].value = "";
box.options[i].text = "";
BumpUp(box);
function BumpUp(abox) {
for(var i = 0; i < abox.options.length; i++) {
if(abox.options[i].value == "") {
for(var j = i; j < abox.options.length - 1; j++) {
abox.options[j].value = abox.options[j + 1].value;
abox.options[j].text = abox.options[j + 1].text;
var ln = i;
break;
if(ln < abox.options.length) {
abox.options.length -= 1;
BumpUp(abox);
function Moveup(dbox) {
for(var i = 0; i < dbox.options.length; i++) {
if (dbox.options[i].selected && dbox.options[i] != "" && dbox.options[i] != dbox.options[0]) {
var tmpval = dbox.options[i].value;
var tmpval2 = dbox.options[i].text;
dbox.options[i].value = dbox.options[i - 1].value;
dbox.options[i].text = dbox.options[i - 1].text
dbox.options[i-1].value = tmpval;
dbox.options[i-1].text = tmpval2;
function Movedown(ebox) {
for(var i = 0; i < ebox.options.length; i++) {
if (ebox.options[i].selected && ebox.options[i] != "" && ebox.options[i+1] != ebox.options[ebox.options.length]) {
var tmpval = ebox.options[i].value;
var tmpval2 = ebox.options[i].text;
ebox.options[i].value = ebox.options[i+1].value;
ebox.options[i].text = ebox.options[i+1].text
ebox.options[i+1].value = tmpval;
ebox.options[i+1].text = tmpval2;
function dosubmit() {
for ( var i = 0; i < document.formtest.list2.length; i++ )
document.formtest.list2.item(i).selected = true;
for ( var i = 0; i < document.formtest.service.length; i++ )
document.formtest.service.item(i).selected = true;
function addservice(service) {
var defaultSelected = true;
var selected = true;
//alert('Here');
var input_box = prompt("Enter some text","");
//alert(input_box);
if(input_box != "")
var optionName = new Option(input_box,input_box,false,false);
var length = service.length;
service.options[length] = optionName;
else
alert("Service should not be empty ! Write Something.");
</script>
<form name="formtest" METHOD="POST" onSubmit="dosubmit()">
<% String sql;
sql = "SELECT LINEID, DESCRIP from PURCHVENDOR.AUTOLINE";
ResultSet results = conn.executeQuery(sql);
%>
<TABLE BORDER="1">
<TR>
<TD>Code/Type</TD>
<TD><INPUT TYPE="TEXT" NAME="vcode" SIZE="38">
<select name="tp">
<option value="S">Standard</option>
<option value="A">Aftermarket</option>
</select>
</TD>
</TR>
<TR>
<TD>Vendor Name</TD>
<TD><INPUT TYPE="TEXT" name="vname" SIZE="54"></TD>
</TR>
<TR>
<TD>Contact Name</TD>
<TD><INPUT TYPE="TEXT" name="cname" SIZE="54"></TD>
</TR>
<TR>
<TD>Address</TD>
<TD><INPUT TYPE="TEXT" name="address" SIZE="54"></TD>
</TR>
<TR>
<TD>P.O.Box</TD>
<TD><INPUT TYPE="TEXT" name="POBox" SIZE="54"></TD>
</TR>
<TR>
<TD>City</TD>
<TD><INPUT TYPE="TEXT" name="city" SIZE="54"></TD>
</TR>
<TR>
<TD>Province/Postal</TD>
<TD>
<INPUT TYPE="TEXT" name="province" SIZE="25" onChange="checkStateCode(this)">
<INPUT TYPE="TEXT" name="postal" SIZE="25" onChange="CheckPostal(this)"></TD>
</TR>
<TR>
<TD>Phone Number</TD>
<TD><INPUT TYPE="TEXT" NAME="pnumber" SIZE="54" onChange="checkUSPhone(this)"></TD>
</TR>
<TR>
<TD>Fax Number</TD>
<TD><INPUT TYPE="TEXT" name="fnumber" SIZE="54" onChange="checkUSPhone(this)"></TD>
</TR>
<TR>
<TD>Fee Stock/Factory</TD>
<TD><INPUT TYPE="TEXT" name="ftock" SIZE="25">
<INPUT TYPE="TEXT" name="ffactory" SIZE="25">
</TD>
</TR>
<TR>
<TD>Prefered Vendor</TD>
<TD><input type="radio" value="1" name="choice" Checked>Yes
<input type="radio" value="2" name="choice">No
</TD>
</TR>
<TR>
<TD>Line Carried</TD>
<TD><select multiple size="5" name="list1" >
<%
while(results.next())
%>
<OPTION value = "<%= results.getString("lineid")%>"><%= results.getString("lineid")%></OPTION>
<%
%>
</select>
<input type=button value="Add" onclick = "javascript:addItem(this.form.list1,this.form.list2);"</input>
<select multiple size="5" name="list2"></select>
<input type=button value="Delete" onclick = "javascript:remove(this.form.list2);"</input>
</TD>
</TR>
<TR>
<TD>Service</TD>
<TD>
<select multiple size="5" name="service"></select>
<input type=button value="Add Service" onclick = "addservice(formtest.service);"</input>
<input type=button value="Delete Service" onclick = "javascript:remove(this.form.service);"</input>
</TD>
</TR>
</TABLE>
<P><INPUT TYPE="SUBMIT" VALUE="Add" onClick="document.formtest.action='addvpdb.jsp';"</input>
<INPUT TYPE="SUBMIT" VALUE="Cancel" onClick="document.formtest.action='vendormain.jsp';"</input>
<!-- <INPUT TYPE="SUBMIT" VALUE="Cancel" onClick= "goback()"</input> -->
</P>
</center>
</form>
</BODY>
</HTML> -
I was wondering how to update a select box with data relevant
to a selection made on a suggest box, something similar to
this,
but with a spry suggest box instead of the first select box on the
example.
I tried the example (two select boxes using two binded data
sets) with my db and it works; when I select something on the first
select box, the second one changes dynamically according to the
selection made.
I have defined two datasets:
var ds1 = new
Spry.Data.XMLDataSet("API/make_entry_list_xml.php","viperdb/entry",{sortOnLoad:"pdb_id",s ortOrderOnLoad:"ascending"});
var ds2 = new
Spry.Data.XMLDataSet("API/get_chains_for_entry_id.php?VDB={ds1::pdb_id}","viperdb/entry/c hain_id");
and defined the suggest and select boxes as:
<div id="suggest_1">
<input type='text' id='vdb1'>
<div id="resultsDIV_1" spry:region="ds1">
<div spry:repeat="ds1" spry:suggest="{pdb_id}"
onClick="ds1.setCurrentRowNumber(this.selectedIndex);"
onchange="ds1.setCurrentRowNumber(this.selectedIndex);">
<div class="suggest_list">{pdb_id}</div>
</div>
</div>
<span spry:region="ds2" id="subdirSelector">
<select spry:repeatchildren="ds2" name="subdirSelect">
<option value="{chain_id}">{chain_id}</option>
</select>
</span>
</div>
Neither onclick nor onchange functions seem to work; on load
the second select does fill up with ds2 data (acording to the first
element of ds1), but when using the suggest box to select something
different, the selectbox doesn't change accordingly, keeping always
the same data.
Am I using the setCurrentRowNumber in the wrong dataset or
tag?I would say if you were to do somthing like this
var ds1 = new
Spry.Data.XMLDataSet("API/make_entry_list_xml.php","viperdb/entry",{sortOnLoad:"pdb_id",s ortOrderOnLoad:"ascending",useCache:false});
see I added the useCache:false
This will stop the browser from cacheing your xml, thenjust
add an onclick to some function like say
update();
then have update do this
function update()
ds1.loadData();
That should cause the browser to update the data set and
update your elements now the only downside is IE has a bug well
more like IE being the bug but anyhow you may have to add things to
your code to get it to work right in IE, I added in some random
number script in my JS so that it will append on the end of my DS
each time so IE thinks its a new XML doc. Hope this helps. -
How to retreive mutiple values from select boxes in jsp
<select name="indices" style="width:180" size="6">
<option value=F_ARCHIVEDATE> F_ARCHIVEDATE </option>
<option value=F_DELETEDATE> F_DELETEDATE </option>
<option value=F_DOCCLASSNUMBER> F_DOCCLASSNUMBER </option>
<option value=F_DOCFORMAT> F_DOCFORMAT </option>
<option value=F_DOCLOCATION> F_DOCLOCATION </option>
<option value=F_DOCNUMBER> F_DOCNUMBER </option>
<option value=F_DOCTYPE> F_DOCTYPE </option>
<option value=F_ENTRYDATE> F_ENTRYDATE </option>
<option value=F_PAGES> F_PAGES </option>
<option value=F_RETENOFFSET> F_RETENOFFSET </option>
<option value=date1> date1 </option>
<option value=id> id </option>
<option value=name> name </option>
</select>..
hi iam having a select box with above option values..when we submitt the page i want retreive all these option values in anohter jsp called retreive.jsp..how can i do that..i want to put all these values in array in that jsp page..
regards,
samHi
In ur code u cant select multiple values. Alter ur code like this
<select name="indices" style="width:180" size="6" multiple> // multiple added here
<option value=F_ARCHIVEDATE> F_ARCHIVEDATE </option>
<option value=F_DELETEDATE> F_DELETEDATE </option>
<option value=F_DOCCLASSNUMBER> F_DOCCLASSNUMBER </option>
<option value=F_DOCFORMAT> F_DOCFORMAT </option>
<option value=F_DOCLOCATION> F_DOCLOCATION </option>
<option value=F_DOCNUMBER> F_DOCNUMBER </option>
<option value=F_DOCTYPE> F_DOCTYPE </option>
<option value=F_ENTRYDATE> F_ENTRYDATE </option>
<option value=F_PAGES> F_PAGES </option>
<option value=F_RETENOFFSET> F_RETENOFFSET </option>
<option value=date1> date1 </option>
<option value=id> id </option>
<option value=name> name </option>
</select>..
in retrieve.jsp write like this
<% String[] mv =request.getParameterValues("indices"); %>
<% for(int i=0; i<mv.length;i++)
{ %>
<br>
<%= mv[i] %>
<% }
%>
I hope it will satisfy u :) -
Pre-selecting from Spry Data Select Box
Hi
I am new here so sorry if this is in the wrong section/format
I am using Two Spry XML Datasets to populate 2 dropdown boxes with vehicle makes and the connected model names (there are other fields but for the sake of clarity I will only show these 2). The XML is dynamically generated by PHP/MySQL and works great for initially creating records. The problem I have is when I want to edit my record and so pre-select the data in the dropdown select box. The first box is easy and works fine but the second box only updates when the first is updated using the 'onchange' and I cannot get it to update on load. I can get it to update 'onclick' or other events but I need it to update the second box when the page loads. Any ideas? I am sure there is a simple solution staring me in the face, but I just can't see it
My code is listed below. I have cut out all the unnecessary code to make it more clear (hopefully)
<script src="../../SpryAssets/xpath.js" type="text/javascript"></script>
<script src="../../SpryAssets/SpryData.js" type="text/javascript"></script>
<script type="text/javascript">
var dsmakes = new Spry.Data.XMLDataSet("xmlgenmake.php", "vehicle/makes");
var dsmodel = new Spry.Data.XMLDataSet("xmlgenmodel.php?xmlmake={dsmakes::make}", "makes/models/model");
</script>
</head>
<body>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<span spry:region="dsmakes" id="makeSelector">
<select spry:repeatchildren="dsmakes" id="makeSelect" name="make" onchange="document.forms[0].modelSelect.disabled = true; dsmakes.setCurrentRowNumber(this.selectedIndex);">
<option spry:if="'{dsmakes::make}' == '<?php echo $row_Recordset1['make']; ?>'" value="{dsmakes::make}" selected="selected">{dsmakes::make}</option>
<option spry:if="'{dsmakes::make}' != '<?php echo $row_Recordset1['make']; ?>'" value="{dsmakes::make}">{dsmakes::make}</option>
</select>
</span><span spry:region="dsmodel" id="modelSelector">
<select spry:repeatchildren="dsmodel" id="modelSelect" name="model">
<option spry:if="'{dsmodel::model}' == '<?php echo $row_Recordset1['model']; ?>'" value="{dsmodel::model}" selected="selected">{dsmodel::model}</option>
<option spry:if="'{dsmodel::model}' != '<?php echo $row_Recordset1['model']; ?>'" value="{dsmodel::model}">{dsmodel::model}</option>
</select>
</span>
</body>
</html>Sorry for not being clear -
The first Spry Select box populates with the Vehicle Makes and selects the stored make from the DB. The second box is supposed to populate with the corresponding Vehicle Models (corresponding to the Vehicle Make in box one) but it initially only populates with the first makes data (not the selected one) if I add: onfocus="dsmakes.setCurrentRowNumber(this.selectedIndex); to the first box it works as it should as soon as it receives focus and the second box updates and selects the correct model.
I have tried adding
Spry.Utils.addLoadListener(InitPage);
function InitPage() {
dsmakes.setCurrentRowNumber(makeSelect.selectedIndex);
but I cannot get the second box to update without clicking on the first
It seems there should be s simple solution to this but I cannot see it. -
Multiple selection box + Substracting cascading dropdown list
I have a multi-select boxe and a drop down but instead of ADDING the choices made in the multi select box to the list of selectable items in the drop down list, I want to SUBSTRACT them.
I'll try to clearify it: if in the multi-slection box you have:
Option A and option B and
in the drop down list, you (depending on you selection) have 2 4 6 8 (options for A) or 4 8 10 12 (options for B).
When selecting BOTH A and B, the drop down liast should ONLY display the values that overlap/exist in both A and B (e.g 4 8).
This would have to work for X number of options in both the multi select box and the drop down list.
Doess anybody know how to make that work?
Thanks in advanced and kind regards!Hi Little_Ghost,
for using a form, seems quite a challenge.
when you select the selection box, or check boxes in the form, you may need to grab the all the selection, and refresh the page with the pre-selected information, so it will be loaded when the page is refreshed.
if you are using infopath template, it may be difficult, since we need 2 infopath form templates associate with list A and B individually, not sure how to interact this cross 2 infopath form template.
my infopath colleague suggest you to try to use one infopath form template with 2 data connections.
i was thinking,
if you could populate the items, for example by using getlistitem()
http://spservices.codeplex.com/wikipage?title=GetListItems
then you may put the result in an array, and ready to compare.
since you would like to use a form, then it may not updated directly, i am not quite sure for this, because as i know you may need to use a button to send out and update/refresh the fields.
http://www.quirksmode.org/js/forms.html
http://www.javaworld.com/article/2077176/scripting-jvm-languages/using-javascript-and-forms.html
or you may have to try to use the data view webpart:
http://www.dotnetcurry.com/showarticle.aspx?ID=581
Regards,
Aries
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. -
How to do it?? in SELECT BOX
here is the bean class sample code of getting the result set from
database
public void setMembers2()
String query1="select e.idcode from employee e,wb_login w where e.idcode=w.idcode ";
stmt1=conn1.createStatement();
rs1=stmt1.executeQuery(query1);
System.out.println("Executed query");
if(rs1.next())
do{
id=rs1.getString(1);
System.out.println("THE IDCODE IS JAVA "+id);
setId_code(id);
} while(rs1.next());
else
System.out.println("THE IDCODES ");
here is the sample code in jsp i have to populate the Idcode's in SELECT BOX
<select name="idcode" size="1" >
<%
String str1="";
promotionbn.setMembers2();
str1=promotionbn.getId_code();
System.out.println("THE IDCODE IN JSP PAGE IS "+str1);
%>
<option value="<%=str1%>"> <%=str1%>
</select>
But in the select box priniting only one record.........Hey,
Where are u defining the get/set methods method ??. The code u gave is not very clear. Acording to what u gave below it will surely print only one record probably the last one.
KM
here is the bean class sample code of getting the
result set from
database
public void setMembers2()
String query1="select e.idcode from employee
e,wb_login w where e.idcode=w.idcode ";
stmt1=conn1.createStatement();
rs1=stmt1.executeQuery(query1);
System.out.println("Executed query");
if(rs1.next())
do{
id=rs1.getString(1);
System.out.println("THE IDCODE IS JAVA
CODE IS JAVA "+id);
setId_code(id);
} while(rs1.next());
else
System.out.println("THE IDCODES ");
here is the sample code in jsp i have to populate the
Idcode's in SELECT BOX
<select name="idcode" size="1" >
<%
String str1="";
promotionbn.setMembers2();
str1=promotionbn.getId_code();
System.out.println("THE IDCODE IN JSP PAGE IS
"+str1);
%>
<option value="<%=str1%>"> <%=str1%>
</select>
But in the select box priniting only one
record......... -
The html select box option is not getting displayed properly in IE11
The html select box option is not getting displayed properly in IE11
I have developed a website that has a select box drop down. The select box drop down is getting displayed properly in IE9. But in IE11, if I am selecting any option apart from the first one, the whole select box option is getting moved up in the page.
In IE11, if option 2 is selected, then the select options is getting moved up. But in IE9, if option 2 is selected, then the select options is getting displayed properly.
Please let me know the fix so that the select options are displayed in the same manner as in IE9.
Sorry but I am unable to upload images as this site is throwing some errorHi Kevin Shen,
Thanks for post.
I tried above code in ie 11(version 11.0.9600.17633).
But it is not working. If you select option 2, and open select box then it open on the select box.
It should open below the select box.
Code for above:-
<select>
<option>1</option>
<option>2</option>
<option>3</option>
</select>
Sorry I could not attach screen shot. We have normal select box with three options. If we select option 2, it is showing option list on the select box. It is coming below the select box in ie 10 and other browse like chrome.
So what we should do, so that all options will come below the select box?
Thanks,
Yogesh Toke -
Multi-Select Box Not Displaying Values Passed From Grid?
Coldfusion 8
I inherited an application and am trying to maintain and improve it... hit a snag today.
I have a multi-select box that is not displaying what I expect. The values come from a ColdFusion grid which is based off a database query.
Here is the code for the select - does not work - nothing is selected:
<cfselect name="USER_IDS" multiple="true" queryposition="below" selected="USER_IDS" query="ActiveUsersPlus" disabled="#disabled#" value="G_USER_WORK_UNIT_SK" display="G_USER_ID" >
</cfselect>
Now if I change the multiselect to a single select like below - it takes the first item in the field list (from the grid) and selects it in the drop down.
<cfselect name="USER_IDS" multiple="false" queryposition="below" selected="USER_IDS" query="ActiveUsersPlus" disabled="#disabled#" value="G_USER_WORK_UNIT_SK" display="G_USER_ID" >
</cfselect>
Or if I assign a variable like this and use the multi-select code it seems to work as well.
testlist = "22,26";
<cfselect name="USER_IDS" multiple="true" queryposition="below" selected="#testlist#" query="ActiveUsersPlus" disabled="#disabled#" value="G_USER_WORK_UNIT_SK" display="G_USER_ID" >
</cfselect>
I have displayed the value of "User_IDs" in the grid and in the data entry part of the screen to see values of: 22,26
to make sure that wasn't my issue.
Do grids and multiselects require something additional? Any advice on how to resolve?Problem was related to some javascript for the select box. There was a function for a single select box but not a multiple select box - this fixed it:
if(theForm.elements[i].type == "select-multiple"){
var selectBox = theForm.elements[i];
var sbname = selectBox.name;
cpvalue = String(eval('record.data.' + sbname));
var NotifyArray = cpvalue.split(',');
for (var j=0; j < selectBox.length; j++) {
selectBox[j].selected = false;
for (var j=0; j < selectBox.length; j++) {
sbvalue = selectBox[j].value;
for (var k=0; k < NotifyArray.length; k++){
if (sbvalue == NotifyArray[k]){
selectBox[j].selected = true; -
Building a select box multiple times on one page.
Hello,
I have a ResultSet rsAgencies that contains all of the information needed to create the options for the agencies select box. It works something like this:
<select name="selAgencyId" id="selAgencyId" class="Standard">
<option value="-1" selected>Select One</option>
<% while (rsAgencies.next()){ %>
<option value="<%= rsAgencies.getInt("id") %>"><%= rsAgencies.getString("name") %></option>
<%}%>
</select>Pretty straight forward. But I need to print these same options out in several different select boxes on the same page and can't figure out how to encapulate this functionality in order to do it.
In ASP, I would have simply had a function declared on this page that I would pass the ResultSet to. It would loop through the rs and build the options.
But JSP won't let me declare a function (or maybe I just don't have the syntax right).
I have also tried putting it in a bean and calling that function from the JSP, but it kindof skips over it for some reason.
If anyone has done this and can give me a nudge toward the best practice, I would be forever grateful.
Thanks
James.Limey,
Thanks. I did not know that about the declaration tags.
Yes, I decided to build a function that accepts a resultset and returns a vector. It allows me to minimize trips to the database as well as loop through multiple times.
I ended up putting that function in a bean that will hold all of my common functions for the application. I assume that is a pretty fairly standard way of sharing functionality from page to page.
Thanks again.
James. -
How can I see the numbers of lines selected in a Multiple Selection Box?
Hi everybody,
what I want to do is to get in an array of numbers all the lines selected.
For instance, if I select the rows 1,4 and 7 from a Multiple Selection Box
of 10 rows in total, how can I see that array when the rows 1,4 and 7 are
selected?
Because I want to connect this numbers to Case Structure and if the only
rows selected are 1,4 and 7, the Case Structure will only realize this cases,
and the rest will be ignored.
I'm sure there is some way to get what I want.
Thank you for your helpful.THANK YOU VERY MUCH. IT WORKS PERFECTLY!!!
"Dennis Knutson" wrote:
>>If you just wire the list box to an array indicator, you will see that
the>output is an array of the selected items. Auto index the array through
a>for loop that has your case statement inside.>>Dennis Knutson>>"Carlos
Jorge" wrote>>Hi everybody,>>what I want to do is to
get in an array of numbers all the>lines selected.>For instance, if I select
the rows 1,4 and 7 from a Multiple>Selection Box>of 10 rows in total, how
can I see that array when the rows>1,4 and 7 are>selected?>>Because I want
to connect this numbers to Case Structure>and if the only>rows selected are
1,4 and 7, the Case Structure will only>realize this cases,>and
the rest
will be ignored.>>I'm sure there is some>way to get what I want.>>Thank you
for your helpful.>> -
Change the default option for a select box
Hi,
I have a select box, with the options built from a Spry Dataset
<select name="AvatarSelect" id="AvatarSelect" spry:region="myAvatars">
<option spry:repeat="myAvatars">{A_NAME}</option>
</select>
I wish to change the default selected option (which is usually the first row returned from the dataset) based on a value for A_NAME that I know from another spry dataset.
Tried using Spry.$$('#AvatarSelect') to get to the the array of select options but to no avail.
How can I cycle through the options and then set the selected on, based on a match for A_NAME?
Cheers
PhilHi Phil
I think this is the way
<select name="AvatarSelect" id="AvatarSelect" spry:region="myAvatarsLookup myAvatarsValue">
<option spry:repeat="myAvatarsLookup" spry:test="'{myAvatarsValue::A_NAME}'=='{myAvatarsLookup::id}'" value="{myAvatarsLookup::id}" selected="selected">{A_NAME}</option>
<option spry:repeat="myAvatarsLookup" spry:test="'{myAvatarsValue::A_NAME}'!='{myAvatarsLookup::id}'" value="{myAvatarsLookup::id}">{A_NAME}</option>
</select>
Cheers -
Dynamic populating the items in the select boxes
Hi,
I need three select boxes on a webpage in such a way that the options in select box 2 should be populated only after selecting some item in "select box 1" and the options in the "select box 3" should be displayed by selecting the options in "the select box2". The data is being retrived from the database. I know that this functionality can be acheived through the "javascript". I am fine until getting the data from the database but not sure how to get it work using javascript.
I would appreciate if someone can post any snippet of code or give any suggesstions or pointer on how to proceed....
-coolersprobably should ask on a javascript forum then. This is for java.
Maybe you are looking for
-
What is the idea of having STRING type when you can't write into that field
Hello friends I am desperately trying to write to a field of a database table with DATA TYPE 'STRING'. When I try to write it using a program from < SE38> or a function <SE37>, I get following error message, while activating the program. ============
-
Logic 9.0 won't allow upgrade to 9.1.8 and SMPTE Bug??
Hi All, I have a lawfully purchased (full retail) fully useable Logic Pro 9.0 version installed on my Mac Mini. Recently, and though I do absolutely no SMPTE work, (and don't really know what it is or use it), when I try to load either a saved templa
-
I'm going to be getting an IPad 3 in the near future. Can I install Elements 11 onto it when I get it?
-
Hi , I am in the process of configuring business package.I want to enable the employee bank details information iview.I have install the business packages. I have created till the JCO Connections they are working perfectly and i am struck at creation
-
Why do I receive phone calls on my iPad?
I received a phone call on my iPad with iOS 8. How do I stop that. I don't like using a speaker phone on my calls.