Populating second select box on the basis of first.
Hello
I want to populate second select box based upon the value selected in first select box from database.The second select box should be in disabled state first and should be enabled only if i select from first selct box. I want to make it by using simple JSp not ajax.
Hello
I want to populate second select box based upon the value selected in first select box from database.The second select box should be in disabled state first and should be enabled only if i select from first selct box. I want to make it by using simple JSp not ajax.
Similar Messages
-
How to populate second combo box on the basis of first combo
Hi All,
Please help me on populating the second combo on the basis of the selected value from first combo.
The values will come from database.
I am using struts and jsp in JBOSS
Regards,
DineshHere's a snippet from one of my jsp's:
TestDel del = new TestDel();
String groups = del.getTestGroupsAsHTMLSelect(
model.getSponsorId(),
"groupCode", //field name
null != values ? (String)values.get("groupCode") : "", // selected
"findTestTypes"); // on change
String tests = del.getTestsAsHTMLSelect(
null != values ? (String)values.get("groupCode") : "",
"test_code",
null != values ? (String)values.get("test_code") :"",
"findSchoolType");It basically returns a select box with the on change attribute set to do what your other reply was talking about. Using AJAX to retrieve the data and then pop it into the page...
I did find that that with mozilla there was some refreshing issue so here's some javascript help:
function findTestTypes(grp){
var url = "/tests/lookup?cmd=test&gc="+grp.value;
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
req.open("GET", url, true);
req.onreadystatechange = showTestTypes;
req.send(null);
function showTestTypes(){
if (req.readyState == 4 && req.status == 200) {
var html = req.responseText;
var tt = getItem("tests");
tt.innerHTML = html;
fireChangeEvent("test_code");
// for mozilla
function fireChangeEvent(fieldName){
if (window.ActiveXObject) {
getItem(fieldName).fireEvent('onchange');
}else{
// target is some DOM node on which you wish to fire an event.
var target = getItem(fieldName);
var oEvent = document.createEvent( "Events" );
oEvent.initEvent(
"change", // the type of mouse event
true, // do you want the event to
// bubble up through the tree? (sure)
true, // can the default action for this
// event, on this element, be cancelled? (yep)
window, // the 'AbstractView' for this event,
// which I took to mean the thing sourcing
// the mouse input. Either way, this is
// the only value I passed that would work
1, // details -- for 'click' type events, this
// contains the number of clicks. (single click here)
1, // screenXArg - I just stuck 1 in cos I
// really didn't care
1, // screenYArg - ditto
1, // clientXArg - ditto
1, // clientYArg - ditto
false, // is ctrl key depressed?
false, // is alt key depressed?
false, // is shift key depressed?
false, // is meta key depressed?
0, // which button is involved?
// I believe that 0 = left, 1 = right,
// 2 = middle
target // the originator of the event
// if you wanted to simulate a child
// element firing the event you'd put
// its handle here, and call this method
// on the parent catcher. In this case,
// they are one and the same.
target.dispatchEvent( oEvent );
} -
LOV doesn't return selected value to the base page
Hi All,
I have created an LOV based on VO. When I select value on the LOV page, it is not returning the selected value to the base page.
I am getting the error when I select any value .
Error
You are trying to access a page that is no longer active.
- The referring page may have come from a previous session. Please select Home to proceed.
Can anyone please guide me which property has to be set.
Thanks,
Edited by: user4482525 on Apr 21, 2009 11:49 PM1> Go to the About this page* of the page and check whether page Root AM is extended or not?
If the page root AM is extended then delete the extension by jdr_util.deleteDocument or using functional Adminstartor
or
2> See in the LOV CO, if you are using the method "releaseApplicationModule"
If yes , then remove this.
Thanks,
Kumar -
BDC uploading on the basis on first row
hi experts,
my requirement is, i have a flat file in excel with csv format, and i have the details of bank details with company name and debit account number and etc., in the first row,
and from second row all the transactions done in that debit account had followed.
my requirement is debit account is having hyphens in the number like,
011-222545-434, i need to remove those hyphens and need to move to single string.
like 011-222545-434 = 011222545435
and then based on this, we need to check it out whether this number is available in the database of SAP, if it matches then,
we need upload all the transactions under this account had to upload into database from the second row.
so please help me out, how to remove hyphens and how to move to one string and how to validate with the sap system??
and after this how to upload the data into database from the second row on the basis of first row details??
it is very urgent, please help me out
murali.Hi Check out this logic. It will work for ur requirement.
DATA: w_data(20) TYPE c VALUE '011-222545-434'.
WRITE:/1 'Before replacing', w_data.
REPLACE ALL OCCURRENCES OF '-' IN w_data WITH space.
CONDENSE w_data.
WRITE:/1 'After replacing', w_data.
If ur variable which hold this number is not character type then pass that value to character variable like above and then use REPLACE statement.
Thanks,
Vinod. -
ClassFileTransformer and how to transform the base class first
Hello,
I've written a ClassFileTransformer that uses ASM to enhance classes at load time.
But some of the enhancements depends on possible enhancements to the super class.
Example: under some coditions a method doWork() is inserted. This method did not exist in any class (doWork is just an example, I use a name that is not accepted by the compiler but allowed by the JLS).
public class A {}
public class B extends A {}If the method doWork() was inserted into class A, then the doWork() of B has to call doWork() of class A:
super.doWork().Currently I try to load the base class by using
loader.loadClass(superName.replace('/', '.'));this loads the super class but without passing my transformer !
How can I solve this ?Looking at the comments in ClassFileTransformer.java and the code in ClassLoader, it seems the transformers are called only for class files that get a ClassFormatError. Transformers are intended to fix old broken/incompatible class files on the fly.
I guess the intended way to do what you are doing is to define a custom class loader. Read class into byte[], transform, call defineClass() on the transformed byte[]. Google for java custom class loader for examples. -
Dynamic Population of Select List
I am stuck in a very frustrating situation at present, I need to dynamically populate select lists based on user choices.
There are three drop down menus, only the first one is pre-populated with the other two populating upon user selection of the previous one. I am using JSP and JavaScript in conjunction. I need to make a function call to a back-end library which exists on a servlet to get the data for the 2nd and 3rd drop down menus, the parameter for the function being the user selected option in the 1st drop down menu.
I know I cannot use the JavaScript "onchange" event handler as that won't help me call the back-end library functions. One way that I think is feasible at the moment is to do page refreshing, i.e. include other JSP's in one main JSP and refresh them as soon the user makes a choice. The other way is to embed an applet in a JSP page and use the JComboBox from the Swing libraries to detect events and make HTTP connections to servlets. I believe there is a possibility of using Struts to do this as well. Can someone tell me which would be the best method to use and a general overview of how to go about using it? I am also open to other alternatives...
Thanx for any help in advancethis can be done in two ways.
one way:- try generating a hidden form fields with the values comma seperated.
like <input type='text' id= id1 name = select1 value = 'coma seperated list of second select values' >
on on change event you can get the list of values which you need to populate in the second select box. generate the options dynamically by splitting the coma seperated list into the second combo.
second way:- while loading the jsp store all the second select box coma seperated list in java script array. and based on the change event of first select box get the corresponding values from the array and split them and generate the options dynamically and populate the second select box.
I guess this way you can solve your problem.
write back to me on [email protected] if you need code snippets.
all the best
kiran J -
Changing the report displayed on the basis of value selected frm the prompt
Hi,
I have requirement in which there is dashboard prompt which has three columns namely year, month and report name.
The user will select the report name from the prompt, once done the report that has been selected should show up
on the dashboard page and he should be able to select data on the basis of month and year from it.
Also, if the user wants to go to the other report he should be able to select it from the prompt and view it.
Pls shed some light on how to progress about it. As of now think if something like this is possible then it would definitley
need two prompts one for report name and the other for month and year.
Thx :)Hi Kishore,
When i click on the link given by you it takes me to a page where a link is given with text as under
Oracle BI 10.1.3.3/2 - Selecting Reports from Dashboard Prompts and Guided Navigation Sections
And when i click on this nothing opens up.
Thx
Edited by: Phantasm on Jun 22, 2010 3:05 AM -
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 -
Hide selection screen option on the base of Transaction code
Hi ,
i have created one report with two diffrenet transaction code .
now we have two different selection options on the base of Transaction code.
how can i do coding for this .
anyone has any sample code ..
thanks,
JackThanks Subramanian,
INITIALIZATION.
if sy-tcode = tcd1.
perform first_selection_screen.
elseif sy-tcode = tcd2.
perform second_selection_screen.
endif.
FORM first_selection_screen..
SELECTION-SCREEN BEGIN OF BLOCK s1 WITH FRAME TITLE text-s02.
SELECT-OPTIONS: s_date FOR vbrk-fkdat.
SELECT-OPTIONS: s_kunag FOR vbrk-kunag.
SELECTION-SCREEN END OF BLOCK s1.
ENDFORM.
But in this perform if i write code for selection-screen then it gives me syntax error.
error message: within form or function module, selection-screen option is not allowed.
Thanks,
Jack -
Multiple Select boxes in one form
Does anyone know if it is possible to have multiple select
boxes inside one form? I have six different select boxes that are
generated by six separate queries. The action page for all six
select boxes is the same so I just want one submit button so users
don't get confuse. I don't want to cluster up the page with submit
buttons but I may resort to that option.
My problem is the select boxes generate a number and when
that number is submitted I want to pass two other variables with it
to the action page. I tried putting a "Form" tag around the 6
select boxes. Inside each select box I tried to add an "Input
type="hidden"" and give thte name and values that I needed. That
worked for the first select box but when I tried the second select
box it used the hidden values for the first select box.
If anyone can help, I would greatly appreciate it. Or if you
have any other suggestions I am open to any.
ThanksPaross1,
I wasn't thinking about that and you gave me a great idea.
Here is how I changed my select boxes.
<cfform
action="Resolution_History.cfm?year=#year#&sessiontype=#sessiontype#&btype=res"
name="form">
<select name="SRINPUT">
<option value="">SR
<CFOUTPUT Query="findSR"><Option
Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
</select>
<select name="HRINPUT">
<option value="">HR
<CFOUTPUT Query="findHR"><Option
Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
</select>
<select name="SCRINPUT">
<option value="">SCR
<CFOUTPUT Query="findSCR"><Option
Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
</select>
<br>
<select name="HCRINPUT">
<option value="">HCR
<CFOUTPUT Query="findHCR"><Option
Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
</select>
<select name="SJRINPUT">
<option value="">SJR
<CFOUTPUT Query="findSJR"><Option
Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
</select>
<select name="HJRINPUT">
<option value="">HJR
<CFOUTPUT Query="findHJR"><Option
Value="#BILLNUMBER#">#BILLNUMBER#</cfoutput>
</select>
<INPUT TYPE="Submit" VALUE="Submit" alt="submit
button">
</cfform>
On the action page I need the below IF statement to work so
it will set the variables. It isn't working at this time. Its not
bringing the values of billnumber, houseorig or the billtype.
Do you have any thoughts? I know it is close. I need to set
all of the inputs to input4 to generate my queries.
<cfif form.srinput gt 0>
<cfset houseorig eq "s">
<cfset billtype eq "r">
<cfset srinput eq input4>
<cfelseif form.hrinput gt 0>
<cfset houseorig eq "h">
<cfset billtype eq "r">
<cfset hrinput eq input4>
<cfelseif form.scrinput gt 0>
<cfset houseorig eq "sc">
<cfset billtype eq "r">
<cfset scrinput eq input4>
<cfelseif form.hcrinput gt 0>
<cfset houseorig eq "hc">
<cfset billtype eq "r">
<cfset hcrinput eq input4>
<cfelseif form.sjrinput gt 0>
<cfset houseorig eq "sj">
<cfset billtype eq "r">
<cfset sjrinput eq input4>
<cfelse>
<cfset houseorig eq "hj">
<cfset billtype eq "r">
<cfset hjrinput eq input4>
</cfif> -
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. -
Can I parse Text files in Java Script to populate in select boxes.
The scenario is as follows:
I have two select boxes, the second one depends on the first one for its values.
Values corresponding to the selection made in the first select box are available in a text file.
Can I parse the text file to fill in the values in the second select box through javascript?
Can any one please help.
Thanks,
RameshThis isn't a javascript forum. Java is not Javascript and Javascript is not Java.
If you actually meant Java...the answer is "maybe, depending on what you're doing". -
Hi all,
I have 3 select boxes in a single JSP page.Like
First Select box
<select name="animal>
<option>Cat</option>
<option>Dog</option>
<option>Donkey</option>
<option>Monkey</option>
</select>
Second select box
<select name="animal>
<option>Dog</option>
<option>Donkey</option>
<option>Monkey</option>
<option>Cat</option>
</select>
Third Select box
<select name="animal>
<option>Donkey</option>
<option>Monkey</option>
<option>Cat</option>
<option>Dog</option>
</select>
I have the requirement like the options has to come like the above.
Is any any ways to do itHello all
I got the solution ie ineach select box i have to forcibly make selected
<html>
<select name="a">
<option value="1" selected>1</option>
<option value="1">2</option>
<option value="1">3</option>
</select>
<select name="a">
<option>1</option>
<option selected>2</option>
<option>3</option>
</select>
<select name="a">
<option>1</option>
<option>2</option>
<option selected>3</option>
</select>
</html> -
Product Variation Select Box Issue
HI all! I'm having an issue with the production variations that I have out of stock and they're still showing in the select dropdown menu. I have tried to get support on this but they're telling me that it's something to do with my template. I haven't been able to find any issue with my template though. Upon inspection of the code, I can see that the select box is being set to "display: none" When I disable this, a second select box appears next to the first select box with the correct inventory available selections. Can anyone help me figure out this issue? Thanks in advance!
{tag_attributes} has been changed to {tag_attributes, vertical, true, false} and all out of stock variations have been disabled.
UPDATE: On CSS style: select, .selectBox - line 504 "style.css" I forced display: inline-block and now you can see the two select boxes upon page load.
UPDATE: For the incorrect select box that showed all the product variations despite their disabled status - i was able to force it to display: none !important --- and it solved this issue. I would still like to know why this was happening if anyone has ideas.
Thanks!Hi mattkrae34,
What version of SpryMenubar.js are you using? You can find
the version on the first line of the file.
Also, do you have a sample URL we can take a look at?
--== Kin ==-- -
I have two select boxes
one is State : which contains list of states and the Second is City
Now basing on the condition of Value in State select box i should retreive the correponding cities of that state from the database and fill the second select box
can any one help meHi,
Add an action listener on the state list box. On select handle the event and get the selected value. Fetch your required list and populate the city list box. You may also retain the selected value in the first list box as that will help you highlight the selection while you are refreshing all the data.
If you get the idea just go and you shall find it all in the link http://java.sun.com/docs/books/tutorial/uiswing/events/
Hope this helps
Aviroop
Maybe you are looking for
-
My Late 2013 Retina MBP had a Kernel Panic - not sure what the source is.
I have a recently-purchased Macbook Pro (late 2013, Retina, 13", 8GB RAM, 2.4 GB i5) that just had a kernel panic this afternoon. This is the first time I've had a kernel panic on this computer, so I don't know what the cause is. It's claiming that '
-
Adobe forms, non-interactive (HR)
Hi, I'm trying to get in touch with SAP web applications (webdynpro, adobe form, bsp...). I have the following requirement: I have to provide a page within the sap enterprise portal to allow the employee to track his presence. In this page the employ
-
Inbound ABAP proxy in the IS localhost
Hello, Is there anyone who knows what I need to do to create an Inbound ABAP Proxy that execute a method in the Integration Server localhost. regards Ernesto Duran
-
IP address is coming in Entered by field in control tab of MO?
Dear SAPIENTS, In the control tab of maintenance order I am able to see IP adress in the field ENTERED BY. Its observed that only to those orders types which are created automatically like preventive maintenance orders or calibration order only this
-
Are there any data modeler freewares available?