How to populate optional items in SELECT BOX
// REGISTRATION.JSP//
<%@ page import="java.util.Enumeration" %>
<%@ page import="java.util.Vector" %>
<%@ page import="java.util.*" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="beans.register2" %>
<jsp:useBean id="registerbn" scope= "session" class="beans.register2" />
<% String base = (String) session.getAttribute("base");
registerbn.setDburl((String)session.getAttribute("dbUrl"));
registerbn.setDbuser((String)session.getAttribute("dbUserName"));
registerbn.setDbpasswd((String)session.getAttribute("dbPassword"));
System.out.println("Inside jsp - setMembers of promotion successful");
registerbn.setMembers();
System.out.println("after setting");
%>
<%
String action=request.getParameter("action");
%>
<HTML>
<HEAD>
<TITLE> TIFR INTRANET </TITLE>
</HEAD>
<HEAD>
<script language="_JavaScript1.2">
function isIdcode()
/ validating
function isUser()
/ validating
function isEmail()
/ validating
function isPassword()
/ validating
function isDob()
/ validating
</javascript> -----java script ends here----------------
<TD align="top" valign="top"><jsp:include page="menu.jsp" flush="true"/>
</td>
<td>
<table cellpadding="2" cellspacing="3" width="40%">
<form method="post" action="./beans.register2">
Fisrt question: we have creaated "register2.java "as beans class for setting the values in to the data base.
is it correct ?
<td width="40" align="center"
<font face="arial" size="5" align="right">
<b>
Registration <hr> </hr>
</b>
</font>
<br>
</td>
<tr valign="center" width="80%">
<td width="40%">
<b><font face="Arial" size="2">IdCode </b> </font>
</td>
<td width="40%">
<b><font face="Arial" size="2">
<input type="text" name="idcode" size="6" style="border-style:solid" value="">
</font></b>
</td>
</tr>
<tr width="80%">
<td width="40%">
<b><font face="Arial" size="2">User </font></B></td>
<td width="40%">
<input type="text" name="user" size="12" style="border-style: solid" value="">
</font></b></td>
</tr>
<tr width="80%">
<td width="40%">
<b><font face="Arial" size="2">Password </font></B></td>
<td width="40%">
<input type="password" name="password" size="25" tabindex="20" style="border-style: solid" width="12" value="">
</font></b></td>
</tr>
<tr width="80%">
<td width="40%">
<b><font face="Arial" size="2">Section code </font></b></td>
<td width="40%">
<select size="1" name="section_code" tabindex="9"
style="border-style: solid">
<%@ include file="section.txt" %>
Secound question:
// inclided simple .txt file here
// what if new item get enlisted in the database , we have to countinuesly update this .txt file ? so we head for creating simple beans class for retriving values
then displaying in the SELECT box
// we dont know how to do it.
//other html tags //
----------------at end -----------------
<input type="Submit" value="Submit" name="B1" > </td>
<td width="40%">
<input type="reset" value="Reset" name="B2"></td>
<%
String action=request.getParameter("Submit");
if(action!=null && action.equals("Submit"))
try{
String idcode=request.getParameter("idcode");
String user=request.getParameter("user");
String password=request.getParameter("password");
String seccode=request.getParameter("section_code");
String Category=request.getParameter("Category");
String BCategory=request.getParameter("BCategory");
String Bheads=request.getParameter("Bheads");
String OtherCategory=request.getParameter("OtherCategory");
String email=request.getParameter("email");
String day=request.getParameter("day");
String month=request.getParameter("month");
String year=request.getParameter("year");
String Dob=day+"/"+month+"/"+year;
String day1=request.getParameter("day1");
String month1=request.getParameter("month1");
String year1=request.getParameter("year1");
String Doj=day1+"/"+month1+"/"+year1;
registerbn.setIdcode("idcode");
registerbn.setUser("user");
registerbn.setPassword("password");
registerbn.setSec_code("seccode");
registerbn.setCategory("Category");
registerbn.setBut_Category("BCategory");
registerbn.setBut_heada("Bheads");
registerbn.setOther_Category("OtherCategory");
registerbn.setemail("email");
registerbn.setDob("Dob");
registerbn.setDoj("Doj");
registerbn.saveData();
/// saveData() is the one method where we are wrintn query to insert in to database//
}catch(Exception ex)
out.println("ERROR :has occured ");
%>
</table>
</table>
</table>
</form>
</td>
</tr>
<jsp include page="Footer.jsp" flush="true"/>
To do that you have to get your recordset, and insert option tags into a while cicle. Something like this:
<select name="mySelectName">
<%while(myRecordSet.next()){%>
<option value="<%=myRecordset.getObject(myField1)>"><%=myRecordset.getObject(myField2)%></option>
<%}%>
</select>
Similar Messages
-
How to Populate values dynamically in Select Box.
Hi All,
I have few select boxes in my webdynpro application. Right now I am populating them using Harcoded values in the Dictionary. But I dont want to harcode the values in the dictionary, i want pull the values from database tables or text files of EP KM. Just let me know which is the better way to populate the select box without hardcoding & why ?
Thanks in Advance.
Regards,
Aditya MetukulHi Aditya,
Getting values from KM and database is possible
It depends on your requirement
ie if the dropdown should contain details of documents from KM or it should display the details in a table
if it is oracle table see this link
Webdynpro and Oracle
if you want to get data from km see this tutorial
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/tutorial on using knowledge management functions in web dynpro - 26.htm
Hope this helps you
Regards
Rohit
Regards
Rohit -
How can I validate a multi-select box to have at least 1 option
How can I validate a multi-select box to have at least 1 option
selected in struts?thanks i will try that other then that if I want to create single drop down list and pass multiple values associated to that drop list value how would i do that....
-
How to populate table rows with selected listbox items?
Hello,
I am trying to populate a table with selected listbox items. Each item should be a new row in the table. The picture below is the listbox and table I am using. I need to get the selected name to populate the Attendee column of the table when the user clicks the Add button. How do you do this with mutltiple attendees selected?
Thank you,
AngieSo you're considering the fact the if the user clicks the button twice, the name will appear twice and you don't want this, right?
Then you must check if any value is the same than the one you are about to add in the row..
for (var i = 0 ; i < ListBox1.length; i++){
if (ListBox1.getItemState(i) == true){
for (var x = 0 ; x < Table1._Row1.count; x++){
var boNewAttendee = true;
var strAttendee = Table1.resolveNode("Row1[" + x.toString() + "]").txtAttendee;
var newAttendee = ListBox1.getDisplayItem(i);
if (strAttendee.rawValue == newAttendee){
boNewAttendee = false;
break;
if (boNewAttendee){
txtAttendee.rawValue = ListBox1.getDisplayItem(i); -
How to populate List Item from the table in a form builder
I want to know how to populate the List Item (pop up menu and combo box) from a table.
Supposing I have a table Customer(cust_id,cust_name)
and now I want to populate it in such a manner that I can update the data back to the database and also access the list on the form.This is the method i am using to populate a list.
1- First of all you need to create a non-database list item for customer_name.
2-create this procedure
PROCEDURE populate_list_with_query
--Populates the given list item with the specified query.
(p_list_item in VARCHAR2
,p_query in VARCHAR2)
IS
/* Name the record group after the list item (no
block prefix). */
cst_rg_name constant VARCHAR2(30) :=
GET_ITEM_PROPERTY(p_list_item,item_name);
v_rg_id RECORDGROUP;
BEGIN
v_rg_id := FIND_GROUP(cst_rg_name);
IF ID_NULL(v_rg_id) THEN
v_rg_id := CREATE_GROUP_FROM_QUERY(cst_rg_name,p_query);
END IF;
IF POPULATE_GROUP(v_rg_id) = 0 THEN
POPULATE_LIST(p_list_item,v_rg_id);
/* Force display of first list element label
in the list item. */
COPY(GET_LIST_ELEMENT_VALUE(p_list_item,1),p_list_item);
END IF;
END populate_list_with_query;
3- Create When-Create-Record on the block level and write this code
BEGIN
POPULATE_LIST_WITH_QUERY('bk1.customer_name',
'SELECT customer_name, to_char(customer_id) FROM customer');
END;
In this example, the customer name is the (visible) list label and the customer ID is the (actual) list value
i hope this will solve your problem ... -
Populate the JSP's select box from database on jsp load
hai all,
can any one help me in knowing how to populate the select box of a jsp
with data from the database?
thanks and regards,
ravikiran<%
String sQuery = "select id,Name from tablename";
rs = stmt.executeQuery(sQuery);
%>
<select name="sltName">
<%
while(rs.next()){
String sId = rs.getString(1);
String sName = rs.getString(2);
%>
<option value="<%=sId %>" > <%=sName %> </option>
<%
%>
</select> -
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 -
How to populate an item first time with a computation ?
Hi
I have a form based on a table. When a new record is created, I want to populate an item with a value retrieved from a sql query. This is why I made an item (named P26_EMAIL) computation based on a nice sql query.
select email from acl_employees
where upper(userid) = upper(:APP_USER)This computation is fired only when a new record is created.
The P26_EMAIL (text field) item source type is DATABASE COLUMN and source used is "Always, replacing any existing value in session state".
Which means that my nice computation value is "erased" by the item when it is computed by APEX.
I am trying to see how to make my item computed on creation of the record, and rest of the time value derived form databse, and cannot get to this result.
Do you have an idea on how to do this ? (without using a trigger)
Thank you very much for your input.
ChristianHi Mani,
What modules do you have? What kinds of signals are you measuring?
Have you deployed your shared variable library on your host PC?
Regards,
Jeremy_B
Applications Engineer
National Instruments -
How to populate one dropdown on select of other dropdown in a table
Hi
My requirement is that I want to populate one dropdown on selection of some value in other drop down.The two dropdown are present in two columns of a Table.
Can any body help for the same.
Regards
NitinHi,
Try This
Bind "enable" properties of Both DD1 and DD2 to
context attributes of type boolean. DD1Enable,DD2Enable
1: set their value to false intially
wdContext.currentContextElement.setDD1Enable(false);
wdContext.currentContextElement.setDD2Enable(false);
Bind the selected property of the table to a
Context attribute of type boolean(Initially false), say "selected"
2: Then use check box in the table to get current lead selection
write in "onToggle" action of checkBox
int len=wdContext.nodeTable().size();
for(int i=0;i<len;i++)
if(wdContext.currentTableElement().getSelected()==true)
wdContext.currentDD1Element().setDD1Enabled(true);
wdContext.currentDD2Element().setDD2Enabled(true);
}else
wdContext.currentDD1Element().setCountryEnabled(false);
wdContext.currentDD2Element().setStateEnabled(false);
This is how u get leadselection and able to change particular row in the table
Regards
Lakshmi -
How to update database with a select box
I'm hoping someone can/will help me with a new feature I'm
trying to add to my web site. I'll summarize what I'm working with
and then proceed to what I'd like to do. This is the web site I'm
working on: www.truckerstoystore.net
I have a database for the Truck of the Week set up with the
information that is output on each page in the left column and
on the Truck of the week page itself. I add new Truck of the
Week (TOW) entries via a form I've put together. Right now, in
order to change the current TOW, I have to manually go into my
template and change the ID (which is automatically assigned when
the record is created, and thus makes it unique) in my SQL which
currently reads
SELECT *
FROM truckofweek
WHERE ID="4"
to the ID of the current TOW.
What I want to be able to do is create a new form that will
allow me to select the TOW entry that I want to be displayed from a
select box (drop down box). I have a good idea of how to populate
my select box, but don't know how to get it to work. My first idea
was to update the table in the database (Access) manually with a
new column called currentTOW, with values set to a Yes/No type,
with default values set to "No". Then I would use my form to set
the value for one of them to "Yes" so I could set my SQL to 'WHERE
currentTOW ="yes" ' I would also make a <cfif> statement that
checks for entries marked "Yes" and changes them to "No" when the
form loads to avoid setting 2 entries to "Yes" and my page thus
attempting to load 2 TOW entries.
My problem is, I don't know how to do any of this. I hope
I've described this situation well enough. I know there has to be
at least one guru on here that can help me. Any assistance would be
greatly appreciated.Hey,
Thanks for replying. That sounds like a good idea, but I
don't know how to do it.
I started working on a new idea, where I have a second table
in the same datasource set up called currentTOW, with one field
called currentTOW and only one record. The idea is to send the
string of the "owner" field from the select box, which is populated
from the table called truckofweek to this one cell in the
currentTOW table.
This way, in my page which will display the data, I have 2
querys. The first pulls the data in the single cell from currentTOW
and outputs its string into the second query. I've attached the
code below. I get an error when I try to display the page, see the
error here:
www.truckerstoystore.net/currentTOW2.cfm.
However, the SQL looks like I want it to look, as "WHERE Owner =
Craig Carp" is essentially the same record that it displays now in
the live page "/currentTOW.cfm" only the SQL currently reads "WHERE
ID = 4" (4 and Craig Carp are part of the same record).
Here is the link to my form:
Form -
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 :) -
How to populate messageChoice items VO dynamicly
Hi all,
I have a messageRadioGroup and a messageChoice in a page. Both of them using picklist VO. i have to populate messageChoice items list with value selected from messageRadioGroup. i tried to set radiogroup action type to fireaction and populate other VO with selection value from controller, but not worked.
How can i do it?
Thanks.Hi Pete,
Sorry forthe mistake. That is quotation. Instead of writing sales document I have written sales order.
Please help me.....
Regards,
Bala -
SO Pricing User Exit - How to know which item is selected for re-pricing.
Hello Experts,
I have to modify material data when user does a update pricing in VA02, the problem is...How do I know which item is selected for re-pricing (in MV45AFZZ)? I am using user exit USEREXIT_PRICING_PREPARE_TKOMP.
For Ex: If my order has 3 items and 2nd one is selected and then 'Update' is done on 'conditions' tab. Above pricing user exit is triggered 3 times for all items, so I cant check XVBAP.
Your help will be appreciated.
Thanks,
SagarHi J@Y,
Thanks for reply. But USEREXIT_PRICING_PREPARE_TKOMP is triggered for all items, so how do I know which is current item?
If you see in debug mode, xvbap-posnr and tkomp-kposn will have 10,20,30 everytime (for 3 times). How do I know if user has selected 20?
Thanks,
Sagar -
How to populate the dropdown in selection widget from a file?
i am using a cq:widget of xtype selection and type select. I got lot of values as my options.i want a simple procedure to populate them. They have mentioned that they can be populated from a json response. Can you explain how to do the same? or is ther any other method for the same
Steve,
You can check OOTB List component at below location.
/libs/foundation/components/list/dialog/items/list/items/displayAs
Here dispalyAs tab having cq:widget of xtype selection in which values are populating through displayoptions.json.jsp which is referenced by options property set on displayAs tab.
Regards
Briejsh Yadav. -
How to populate data in drop down box dynamically in adobe form?
Dear Experts.
I am new to adobe interactive form can anybody please tell me how to fill data in a drop down box dynamically? I am using webservices method.
Thanks in advance.
Chitta Ranjan Mahato
Edited by: mahato123 on Aug 5, 2011 12:16 PMyou can create a method to populate the context attribute that you are using to map to your dropdown box.
DATA: node_info TYPE REF TO if_wd_context_node_info.
DATA: it_table TYPE wdr_context_attr_value_list.
** select your dropdown data into it_table and pass it to your context attribute.
** here, mine is call PROJ_TYPE - the values should appear in your dropdown.
node_info->set_attribute_value_set(
name = 'PROJ_TYPE'
value_set = it_table ).
Maybe you are looking for
-
I just downloaded iTunes 11.1 and my iTunes Radio is not working. HELP!
I just downloaded iTunes 11.1 and my iTunes Radio is not working. When I go to play a station it says "We could not complete your iTunes Store request. You are not authorized to access the requested resource. There was an error in the iTunes Store. P
-
Nested Tables and Predictable Attributes
BOL states "The data in a nested table can be used for prediction or for input, or for both. For example, you might have two nested table columns in a model: one nested table column might contain a list of the products that a customer has purchased,
-
Non blocking jDialog & return values
Hi, I have (at the center of this problem) 3 classes. A controller class, and two jDialog windows. The controller initiates the first jDialog window (a main menu window). When the use clicks on a button the second jDialog window opens (a search windo
-
Can't get Calendar to notify me about an appointment. Windows 7
I enter a date and time in Calendar so I'll be notified of an appointment. Everything works fine - it accepts the time and message- but I am never notified of the appointment in mail. This has happened since I updated to Windows 7 with a new computer
-
Where can I get a version of Mac OS X 10.5? My mac is currently using 10.4.11.