Conditional validation for drop down list
Hi all,
I have been working on getting the conditional validation for drop down list to work but no luck. Here is my situation. I have a page with 'time' and 'source' drop down which contains a list of values along with null value. I have two buttons 'save' and 'close'. when a User clicks on 'Save' button, no checking should occur and the values filled in the form should be stored into the database. When a user clicks on 'Close' button, validation should occur and messages should be displayed saying 'values should be filled' . After the user fills each drop down list and hits close button, changes should be saved to the database. I used the technique posted by Jayashri and wrote the validation code in 'Close button action method'
Here is my code
public String btnClose_action() {
// TODO: Replace with your code
try {
if (ddlTime.getSelected() == null || ddlTime.getSelected().equals("")) {
FacesMessage message3 = new FacesMessage("Please select a value");
message3.setSeverity(FacesMessage.SEVERITY_ERROR);
getFacesContext().addMessage(ddlTime.getClientId(getFacesContext()), message3);
return null;
if (ddlSourceReq.getSelected() == null || ddlSourceReq.getSelected().equals("")) {
FacesMessage message4 = new FacesMessage("Please select a value");
message4.setSeverity(FacesMessage.SEVERITY_ERROR);
getFacesContext().addMessage(ddlSourceReq.getClientId(getFacesContext()), message4);
return null;
sendMail("close");
} catch (Exception ex) {
return null;
public String btnSave_action() {
// TODO: Process the button click action. Return value is a navigation
// case name where null will return to the same page.
sendMail("save");
return null;
I did not set the 'required' property of both the drop downs and I dont have any message components in the page. How do I get this to work. Please help.
Thanks,
S
Hi,
Try this
HTP.p('
function validate_form_fields()
var validation = true;
if (document.forms[0].fld_1.options[document.forms[0].fld_1.selectedIndex] == null )
validation = false;
alert("Selection of FLD1 is mandatory.");
if (document.forms[0].fld_2.options[document.forms[0].fld_2.selectedIndex] == null )
validation = false;
alert("Selection of FLD 2 is mandatory.");
return validation;
');If the above does not work, it could be the definition of the your fld_1 select - options. Looks like they allow null values, and if null is not the first option then selectIndex = 0 will be a not null option by default.
Moreover, the below has redundant condition as ==0 and < 1 amount to the same thing. selectIndex cannot be negative.
if ((document.forms[0].fld_1.selectedIndex == 0 ) || (document.forms[0].fld_1.selectedIndex < 1 ))Regards,
Similar Messages
-
JS Validation for Drop down List is not working in Oracle PL/SQL Package
Hi All,
I am facing an issue with JavaScript validation done in Oracle PL SQL package.
System Requirement:
There is one screen which contains two fields viz. FLD 1 & FLD 2 and one 'Submit' button.
FLD 1 and FLD 2 fields are drop down list boxes.These are mandatory fields.
The screen is developed in Oracle Mod PL SQL package.
The html coding and java scripting are embedded in the respective Oracle PL SQL Package procedure which generates this screen,takes the input values provided by user,does the
field validations and submits the form.
Issue:
The javascript validation for FLD 2 dropdown is working successfully.
When the user leaves this field as blank,the embedded javascript pops up an error message 'Selection of FLD 2 is manadatory before submitting the form!'.
As FLD 1 is also a mandatory field,the javascripting validation should pop up the similar error message 'Selection of FLD 1 is manadatory before submitting the form!'.
But,this first field validation is not at all working.
The system allows to submit the form even if the 'FLD 1' is left blank.
The javascript code sysntax for validation of FLD 1 & FLD 2 drop down list boxes as follows:
function validate_form_fields()
if (document.forms[0].p_fld_1.selectedIndex == 0))) || (document.forms
[0].p_fld_1.selectedIndex < 1 )
alert("Selection of FLD 1 is manadatory before submitting the form!!!");
return false;
else if (document.forms[0].p_fld_2.selectedIndex == 0))) || (document.forms
[0].p_fld_2.selectedIndex < 1 )
alert("Selection of FLD 2 is manadatory before submitting the form!!!");
return false;
return true;
I am viewing the screen from the web browser IE version 8.0.
Your timely help will really be appreciated.
Regards & Thanking in advance,
AlkaHi,
1. Your problem is actually related to JavaScript, not SQL and PL/SQL. So, this is the wrong forum to post. The closest to JS is the Application Express forum {forum:id=137}. Clearly state that it is not an Apex issue and that you are looking for JS help.
2. Your JS code, the way you has posted it, is syntactically incorrect, so if you post on Apex forum put the correct code and in tags as described in the FAQ
{quote}
function validate_form_fields()
if (document.forms[0].p_fld_1.selectedIndex == 0))) || (document.forms
[0].p_fld_1.selectedIndex < 1 )
alert("Selection of FLD 1 is manadatory before submitting the form!!!");
return false;
else if (document.forms[0].p_fld_2.selectedIndex == 0))) || (document.forms
[0].p_fld_2.selectedIndex < 1 )
alert("Selection of FLD 2 is manadatory before submitting the form!!!");
return false;
return true;
{quote}
Regards, -
Swap textbox for drop-down list in "search" section of work list panel
Hi everybody
I am using albpm 6.0, when I do searches for instances in the work list panel I can add conditions to the search, for example if I select the "Priority" condition I can select my condition from a drop-down list but if I select the "Description" condition there isn't drop-down list instead a textbox appear so my question is: Can I control or change that behavior? I would like to do that when someone select the "Description" condition a drop-down list containing the values appear so he doesn't have to type anything.
Thank youHi,
can you share the solution,even i was trying to archive the same.Thanks in advance. -
SAP Design Studio 1.2 sp01 Filters logic is required for drop down list component
Hi all,
I am working with sap ds 1.2 sp01,In dropdown list, assume it has X,Y,Z. So defaulty it shows first "X' value in Dropdown list , but in Croos tab from DS_1, it is not related to "x" value, it shows overall Values In formation,but i want "x" value Information.. How can i get in DS?, PLEASE HELP ME OUT.
.below logics i applied in drop down list component.
DS_1.setFilter("Dimension Name", DROPDOWN_1.getSelectedValue());
and below logic in Application on Startup event:
DROPDOWN_1.setItems(DS_1.getMemberList("dimension name", MemberPresentation.INTERNAL_KEY, MemberDisplay.KEY, 10));
Thanks
Thiru.GHi,
Try adding "DS_1.setFilter("Dimension Name", DROPDOWN_1.getSelectedValue()); " after
"DROPDOWN_1.setItems(DS_1.getMemberList("dimension name", MemberPresentation.INTERNAL_KEY, MemberDisplay.KEY, 10));"
on startup event too. You should tell the application that you need to filter the data, even if you don't select it manually from the dropbox, in other words ; on startup.
Regards,
Onur -
Drop down list in report program
Hi all,
I am using the function module VRM_SET_VALUES to display the drop down list for a selection screen field for a report program. It works fine in foreground but in background mode the job is getting cancelled and the error log states 'Make an entry in all required fields'. If I remove this code for drop down list for a selection screen field then the program runs correctly in back ground mode. So i feel there is some problem with the function module. Can anyone suggest me an alternate function module or how to correct this error. I have used the condition if 'SY-BATCH' is initial only then to exceute the code for displaying the drop down list for a selection screen field. But even then the background job gets cancelled. The function module is called in the event AT SELECTION-SCREEN output.
Thank you.
Regards,
Sowmya.Hi,
Easy! You are calling that function module in the wrong event. It should be called in :
at selection-screen on value-request for <field name>
This way it is only executed if the user presses F4 (dropdown help) on that field.
Therefore it will no longer cause a problem for your background job.
cheers
Paul Bakker
Hanabi Technology -
Dear Expert,
I am new to OOPS ,
I want to display drop down list for a particular field in my output, so I am using OOPS but in my below code
I am facing problem in displaying the output as I am getting the error message
Field catalog not found...
Also advice me how to display drop down list in a particular field.
Please advice
MODULE pbo OUTPUT.
SET PF-STATUS 'ZTEST'.
IF g_custom_container IS INITIAL.
DATA: lt_exclude TYPE ui_functions,
lt_f4 TYPE lvc_t_f4 WITH HEADER LINE.
CREATE OBJECT g_custom_container
EXPORTING
container_name = g_container.
CREATE OBJECT g_grid
EXPORTING
i_parent = g_custom_container.
PERFORM field_catalog TABLES it_lvc_t_fcat
USING: 'S_FINAL' 'MATNR' ' ' 'Part Number' ' ' ' ',
'S_FINAL' 'MAKTX' ' ' 'Part Description' ' ' ' ',
'S_FINAL' 'MBLNR' ' ' 'Document No' ' ' ' ',
'S_FINAL' 'BLDAT' ' ' 'Document date' ' ' ' ',
'S_FINAL' 'LIFNR' ' ' 'Vendor Number' ' ' ' ',
'S_FINAL' 'STATUS' ' ' 'Acknowledgement' ' ' 'X',
'S_FINAL' 'REMARKS' ' ' 'Remarks' ' ' 'X'.
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
* I_STRUCTURE_NAME =
is_layout = it_lvc_s_layo
CHANGING
it_outtab = i_final
it_fieldcatalog = it_lvc_t_fcat
ENDIF.
ENDMODULE. " PBO OUTPUT
FORM field_catalog TABLES t_field_catalog STRUCTURE wt_lvc_s_fcat
USING fp_tabname TYPE any
fp_fieldname TYPE any
fp_key TYPE any
fp_text TYPE any
fp_do_sum TYPE any
fp_edit TYPE any.
t_field_catalog-tabname = fp_tabname.
t_field_catalog-fieldname = fp_fieldname.
t_field_catalog-key = fp_key.
t_field_catalog-seltext = fp_text.
t_field_catalog-do_sum = fp_do_sum .
t_field_catalog-edit = fp_edit .
ENDFORM. "field_catalog
Edited by: Karthik R on Mar 15, 2010 6:11 PMHi Karthik,
Below mentioned is a Simple code for creating dropdown lists for columns in ALV grid output
REPORT z_alv_dropdown.
*Type pools declarations for ALV
TYPE-POOLS : slis.
*data declarations for ALV container, ALV grid, Field catalogues & layout
DATA: g_grid TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container,
gt_fieldcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo.
*INTERNAL TABLE AND WA DECLARATIONS FOR t517 A table
DATA: gt_outtab TYPE STANDARD TABLE OF t517a INITIAL SIZE 0,
wa_outtab TYPE t517a.
*initialisation event
INITIALIZATION.
*Start of selection event
START-OF-SELECTION.
*Call to ALV
CALL SCREEN 600.
*On this statement double click it takes you to the screen painter SE51.
*Create a Custom container and name it CCONT and OK code as OK_CODE.
*Save check and Activate the screen painter.
*Now a normal screen with number 600 is created which holds the ALV grid.
PBO of the actual screen , Here we can give a title and customized menus
Here we also call the subroutine for ALV output.
MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
set pf-status 'xxx'.
set titlebar 'MAIN100'.
Subroutine to display the output in alv
PERFORM alv_output.
ENDMODULE. "pbo OUTPUT
PAI module of the screen created. In case we use an interactive ALV or
*for additional functionalities we can create OK codes and
based on the user command we can do the coding.
MODULE PAI INPUT *
MODULE pai INPUT.
ENDMODULE. "pai INPUT
*& Form BUILD_FIELDCAT
FORM build_fieldcat.
DATA ls_fcat TYPE lvc_s_fcat.
*Build the field catalogue
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'T517A'
CHANGING
ct_fieldcat = gt_fieldcat.
To assign dropdown in the fieldcataogue
LOOP AT gt_fieldcat INTO ls_fcat.
CASE ls_fcat-fieldname.
WHEN 'SLART'.
*drdn-hndl = '1' is the first list box
ls_fcat-drdn_hndl = '1'.
ls_fcat-outputlen = 15.
MODIFY gt_fieldcat FROM ls_fcat.
*drdn-hndl = '2' is the second list box
WHEN 'ABART'.
ls_fcat-drdn_hndl = '2'.
ls_fcat-outputlen = 15.
MODIFY gt_fieldcat FROM ls_fcat.
ENDCASE.
ENDLOOP.
ENDFORM. "build_fieldcat
*& Form ALV_OUTPUT
FORM alv_output .
*Create object for container
CREATE OBJECT g_custom_container
EXPORTING container_name = 'CCONT'.
*create object for grid
CREATE OBJECT g_grid
EXPORTING i_parent = g_custom_container.
Build fieldcat and set column
*Assign a handle for the dropdown listbox.
PERFORM build_fieldcat.
*Build layout
PERFORM build_layout.
Define a drop down table.
PERFORM dropdown_table.
*fetch values from the T517A table
SELECT * FROM t517a INTO TABLE gt_outtab.
*Display ALV output
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_fieldcatalog = gt_fieldcat
it_outtab = gt_outtab.
ENDFORM. "ALV_OUTPUT
*& Form dropdown_table
text
--> p1 text
<-- p2 text
FORM dropdown_table.
*Declarations for drop down lists in ALV.
DATA: lt_dropdown TYPE lvc_t_drop,
ls_dropdown TYPE lvc_s_drop.
First SLART listbox (handle '1').
ls_dropdown-handle = '1'.
ls_dropdown-value = '01 Pink'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '02 Yellow'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '03 Green'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '04 Black'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '05 White'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '06 Blue'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '09 Other Colors'.
APPEND ls_dropdown TO lt_dropdown.
*method to display the dropdown in ALV
CALL METHOD g_grid->set_drop_down_table
EXPORTING
it_drop_down = lt_dropdown.
ENDFORM. " dropdown_table
*& Form build_layout
text
*layout for ALV output
FORM build_layout .
gs_layout-cwidth_opt = 'X'.
gs_layout-grid_title = 'ALV DROPDOWN LISTS'.
gs_layout-no_toolbar = 'X'.
ENDFORM. " build_layout
Hope it is helpful,
Regards,
Soundarya. -
Dynamic Drop-down list - selected value can't be cleared ...
1. check out the following code of a dynamic drop down list using cursor :-
DECLARE
-- DROP-DOWN LIST OF ALL DEPARTMENTS
TEMPNUMBER NUMBER(2) := 2 ;
-- Because we've to initialize the list
-- at least with 1 item.
CURSOR C_DEPT IS
SELECT DEPT_ID FROM DEPARTMENT;
BEGIN
ABORT_QUERY ;
CLEAR_LIST('DEPTLIST');
FOR TEMP IN C_DEPT LOOP
ADD_LIST_ELEMENT( 'DEPTLIST', TEMPNUMBER, TEMP.DEPT_ID, TEMP.DEPT_ID );
:SRBLOCK.LST := TEMP.DEPTNO;
-- prev. line set the newly selected value
TEMPNUMBER := TEMPNUMBER + 1 ;
END LOOP;
END;
2. problem is as we've to atleast initialize with one list item... that item can't be cleared with CLEAR_LIST.
3. how can i actually clear that and still use cursor. because i've searched forum for this thing and found all those code not working ... for my project ...
4. quick help needed ...Hi Omar,
I have solution for you
To populating or refreshing the lists you can use
two procedures:
One of them - generic, which can be used for all types of list
Another is specific which contain a SQL statement to retrieve the data for
particular list.
1. Specific procedure:
PROCEDURE GET_DEPARTMENT_LIST
IS
sql_stat VARCHAR2(32767);
ret_code NUMBER;
BEGIN
-- SQL Statement for Drop-down List
-- (must have two columns for label and value - both VARCHAR2)
sql_stat := ' SELECT DEPARTMENT_NAME,TO_CHAR(DEPT_ID)'
||' FROM SCHEMA.DEPARTMENT';
POPULATE_MY_LIST('BLOCK.DEPARTMENT_LIST',sql_stat,ret_code);
END;
2. Generic procedure:
PROCEDURE POPULATE_MY_LIST
(item_name VARCHAR2,
sql_stat VARCHAR2,
out_code OUT NUMBER)
IS
rg_id RECORDGROUP;
rg_name VARCHAR2(100);
ret_code NUMBER;
item_id ITEM;
BEGIN
item_id := FIND_ITEM(item_name);
IF ID_NULL(item_id) THEN
out_code := -1;
RETURN;
END IF;
--Creating Record Group with Unique Name
rg_name := 'RG_'||SUBSTR(item_name,INSTR(item_name,'.',1)+1,LENGTH(item_name));
--Checking Record Group Name for existance
rg_id := FIND_GROUP(rg_name);
--If Group does exist - delete it
IF NOT ID_NULL(rg_id) THEN
DELETE_GROUP(rg_id);
END IF;
--Creating Record Group
rg_id := CREATE_GROUP_FROM_QUERY(rg_name,sql_stat);
ret_code := POPULATE_GROUP(rg_id);
IF (ret_code <> 0) THEN
out_code := ret_code;
RETURN;
END IF;
POPULATE_LIST(item_name,rg_id);
IF NOT FORM_SUCCESS THEN
out_code := -2;
RETURN;
ELSE
out_code := 0;
END IF;
DELETE_GROUP(rg_id);
END;
Hope it help.
Dmitry -
Columns in af:table rendering multiple times when filtering drop-down list
Technology: JDeveloper 10.1.3.0.4 SU5, ADF Faces/BC
Page design:
Master-detail jspx.
Each section is an af:table.
Drop-down lists created using instructions from http://www.oracle.com/technology/products/jdev/tips/muench/screencasts/editabletabledropdown/dropdownlistineditabletable.html?_template=/ocom/technology/content/print
Requirement:
Data in a drop-down list on a child record needs to be filtered based on data from one or more columns in the currently selected row of the parent record.
Issue:
Drop-down lists have been successfully filtered using a couple of different methods, however, any time the data from the parent record is used to filter the data the columns in the child af:table begin to render multiple times. Navigating through the parent rows may cause the child records to have the correct number of columns displayed or multiple copies of the columns displayed.
Removing any reference to the parent view object and hard-coding values instead causes this behavior to disappear.
Each of the following methods has been tried. Each filters drop-down list data correctly and each causes apparently random extra column renders.
1. Cascading lists as per: http://www.oracle.com/technology/products/jdev/tips/mills/cascading_lists.html
2. Drop-down list based on view object that takes parameters.
3. Set where clause for drop down list in a method on the app module.
4. Set where clause for drop-down list in a new selection listener method for the af:table.
Question:
Is there a solution available that will filter the drop-down lists correctly and prevent the extra columns from being rendered?
Thank you for any help that you can provide,
Joannebump
-
SQL function column in drop down list's data provider's query
Just wondering, if it is somehow possible to use SQL function column for drop down list through data provider.
At the moment, I am using id column as return value and name as display value from this query through CachedRowSetDataProvider:
SELECT ALL someTable.Id,
someTable.Name,
someTable.Postal_Code,
FROM someTable
However, I want to change display to use calculated column as display value, for example Name_PostalCode from below mentioned changed query:
SELECT ALL someTable.Id,
CONCAT(someTable.Name, ' - Pin Code: ',someTable.Postal_Code) Name_PostalCode ,
someTable.Name,
someTable.Postal_Code,
FROM someTable
But JSC doesn't seem to like this.
Is it someway possible to achieve this?
Thanks.>
But JSC doesn't seem to like this. Can you explain more. When doesn't it like it, in the design view, in the query editor, when your run it? What is the error you are seeing?
See http://blogs.sun.com/divas/entry/displaying_multiple_fields_in_a -
Dynamic drop down list in Adobe forms
I have created a drop down list using enumerated drop down list from webdynpro native tab and binded in the object palette by giving $record.sap-vhlist.DESCR\.DATA\.FIELD.item[]* in the list items dynamically.DESCR is the field in the internal table into which i fetched data from the database table .I have written this code in a BADI.I dont know whether my form's display type is activex or native? I am not getting any values in the drop down list.can anybody please tell me what might be missing and how should i know whether my form is ActiveX or Native?
My form is called from portal so i have used BADI to connect portal to formHi sarang,
I have done a dynamic drop down list in which DESCR field comes from database table and pops into the drop down dynamically. I was working for a PCR scenario so the adobe form was called from portal.I will tell u all the required steps.It might work for u as it is working for me:
1.In the form:
I used two elements from library first is a "ENUMERATED DROP DOWN LIST NO SELECT" from web-dynpro native tab and second is "ISR_TEXT DISPLAY INVISIBLE ON EDIT MODE" from ISR controls tab.Place them one on other inthe form.
For drop down list the setting are:
In object, field tab click on list items there in ITEMS put :$record.sap-vhlist.DESCR\.DATA\.FIELD.item[*].in ITEMS TEXT write text in ITEMS KEY write key.
In binding,in default binding put $record.DESCR.DATA[*].FIELD.
For text element the settings are:
In binding,default binding put Normal.
when we select ISR_TEXT DISPLAY INVISIBLE ON EDIT MODE it automatically comes with calculated read only int he value tab.so open script editor and place the below code:
$record.DESCR.DATA.FIELD (in calculate).
2.Now the code in BADI is as follows:
In BADI we have to write the code for drop down list in the METHOD "SCENARIO_SET_ADDITIONAL_VALUES"
As i didnt change the standard BADI i added an enhancement spot in which i wrote a function module which fills ADDITIONAL_DATA. and the below code fills the ADDITIONAL_DATA .
DATA: t_t572b TYPE STANDARD TABLE OF t572b WITH HEADER LINE,
t_t554t TYPE STANDARD TABLE OF t554t WITH HEADER LINE.
SELECT * FROM t572b INTO TABLE t_t572b WHERE sprsl EQ 'E'.
CLEAR ls_additional_data-fieldindex.
LOOP AT t_t572b.
ADD 1 TO ls_additional_data-fieldindex.
ls_additional_data-fieldname ='DESCR_KEY'.
ls_additional_data-fieldvalue = t_t572b-descd.
APPEND ls_additional_data TO additional_data.
ls_additional_data-fieldname ='DESCR_LABEL'.
ls_additional_data-fieldvalue = t_t572b-descr.
APPEND ls_additional_data TO additional_data.
CLEAR t_t572b.
ENDLOOP.
For DESCR field the we have to declare DESCR_KEY and DESCR_LABEL in the place holders for key values and palce holders for default values in characteristics tab(where all the fields for the form are defined) of ur respective scenario.(where ur pcr scenario is defined)
Hope ur problem got resolved.
Please let me know if any doubts.
If ur form is not called from portal and u want a dynamic drop down list the difference is put a data drop down list and in object, field tab click on list items there in ITEMS select the field into which u populated the data from the database table (this code shud be written in code Initialization in the respective interface) and in ITEMS TEXT put $ in ITEMS KEY put $.and in binding as we normally do bind it to the respective field in which the data is populated from database table.
It should work. -
Hi,
I am new to Livecycle and am currently updating administration forms to make them interactive. I am having trouble with FormCalc for the expenses form. There are columns for kilometres, rate (drop-down list) and total. Basically I want 'kilometres' x 'rate' to equal 'total'. I can total the kilometres x rate easily if they are both numerical boxes, but once the rate column becomes a drop-down list with three different value options, it will not calculate for me. Do I have to change the formula for drop-down lists?
Thank you!
KateThe issue is the $ sign in the dropdown. By adding the $ sign you are making this a string and not a number. To fix this you can do it in one of two ways. You can remove the dollar sign or you can leave the dolloar sign in plcae and take advantage of how Dropdowns work. You can have a specific value shown (this is the Displayed Value) but then have a completely different value used when asked for the DDList value (this is the data value). So I modified the DDLists to have a different data value (without the $) then modified the command to use the data value for the calculation. I changed the calculation to run on the Calculate event of the Total field. The calculate event will fire when the form loads as well as any time a referenced field in the calculate changes. So when you select a rate the total field will fire automagically!
Oh by the way the data values are set on the binding tab of the DropDown field.
I have attached a modified version of the form you sent.
Paul -
Cteate 2 Dynamic drop down list
Hi all
i want to create 2 dynamic drop down list using struts and hibernate
i want the first one to display countries name then if i select a country name the second drop down list will automatic display the country cities .
i'm using database here and my tables like that :-
country table
country_id number(3) pk
country_name varchar(50)
city table
city_id number(5) pk
country_id(3) fk references country(country_id)
city_name varchar(50)
thank you in advanceHi Omar,
I have solution for you
To populating or refreshing the lists you can use
two procedures:
One of them - generic, which can be used for all types of list
Another is specific which contain a SQL statement to retrieve the data for
particular list.
1. Specific procedure:
PROCEDURE GET_DEPARTMENT_LIST
IS
sql_stat VARCHAR2(32767);
ret_code NUMBER;
BEGIN
-- SQL Statement for Drop-down List
-- (must have two columns for label and value - both VARCHAR2)
sql_stat := ' SELECT DEPARTMENT_NAME,TO_CHAR(DEPT_ID)'
||' FROM SCHEMA.DEPARTMENT';
POPULATE_MY_LIST('BLOCK.DEPARTMENT_LIST',sql_stat,ret_code);
END;
2. Generic procedure:
PROCEDURE POPULATE_MY_LIST
(item_name VARCHAR2,
sql_stat VARCHAR2,
out_code OUT NUMBER)
IS
rg_id RECORDGROUP;
rg_name VARCHAR2(100);
ret_code NUMBER;
item_id ITEM;
BEGIN
item_id := FIND_ITEM(item_name);
IF ID_NULL(item_id) THEN
out_code := -1;
RETURN;
END IF;
--Creating Record Group with Unique Name
rg_name := 'RG_'||SUBSTR(item_name,INSTR(item_name,'.',1)+1,LENGTH(item_name));
--Checking Record Group Name for existance
rg_id := FIND_GROUP(rg_name);
--If Group does exist - delete it
IF NOT ID_NULL(rg_id) THEN
DELETE_GROUP(rg_id);
END IF;
--Creating Record Group
rg_id := CREATE_GROUP_FROM_QUERY(rg_name,sql_stat);
ret_code := POPULATE_GROUP(rg_id);
IF (ret_code <> 0) THEN
out_code := ret_code;
RETURN;
END IF;
POPULATE_LIST(item_name,rg_id);
IF NOT FORM_SUCCESS THEN
out_code := -2;
RETURN;
ELSE
out_code := 0;
END IF;
DELETE_GROUP(rg_id);
END;
Hope it help.
Dmitry -
Drop down lists using VRM_SET_VALUES
Hello All ,
i am calling VRM_SET_VALUES for drop down list, by exporting the ID and VALUES.
total i am passing 6 values, so first time when i am in selection screen , it is displaying 6 values. fine ia m happy with this.
after executing the selection screen , if i come back, and see the drop down list , now this contains 7 values, the extra 7th value is what i selected first time. (so what i selected first time is now coming again, this entry is duplicated, now this entry is displaying at the bottom of the list , in capital letters). i dont want this extra entry, can some tell a way how to remove this.
P.S. i searched SDN , i dint find any problem releated this
Thanks in advance.
Best Regards,
Amarender Reddy B.Hi,
Refer code:-
TABLES : Y_MOVIE.
TYPE-POOLS: VRM.
TYPES : BEGIN OF MOVIE,
YR LIKE Y_MOVIE-YR,
CATEGORY LIKE Y_MOVIE-CATEGORY,
WINNER LIKE Y_MOVIE-WINNER,
NOTES LIKE Y_MOVIE-NOTES,
END OF MOVIE.
DATA: NAME TYPE VRM_ID,
LIST TYPE VRM_VALUES,
VALUE LIKE LINE OF LIST,
MOVIETAB TYPE STANDARD TABLE OF MOVIE INITIAL SIZE 10 WITH HEADER LINE.
PARAMETERS: CATEGORY(10) AS LISTBOX VISIBLE LENGTH 10.
AT SELECTION-SCREEN.
IF CATEGORY EQ ''.
MESSAGE E006.
ENDIF.
AT SELECTION-SCREEN OUTPUT.
NAME = 'CATEGORY'.
VALUE-KEY = 'PIC'.
VALUE-TEXT = 'PIC'.
APPEND VALUE TO LIST.
VALUE-KEY = 'MAL'.
VALUE-TEXT = 'MAL'.
APPEND VALUE TO LIST.
VALUE-KEY = 'FEM'.
VALUE-TEXT = 'FEM'.
APPEND VALUE TO LIST.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = NAME
VALUES = LIST.
START-OF-SELECTION.
WRITE : / 'Category Selected :', CATEGORY.
ULINE.
SELECT *
FROM Y_MOVIE INTO CORRESPONDING FIELDS OF TABLE MOVIETAB
WHERE CATEGORY = CATEGORY.
END-OF-SELECTION.
WRITE : /1 'Year', 6 'Category', 16 'Winner', 50 'Notes'.
ULINE.
LOOP AT MOVIETAB.
WRITE : /1 MOVIETAB-YR, 8 MOVIETAB-CATEGORY, 16 MOVIETAB-WINNER, 50 MOVIETAB-NOTES.
ULINE.
ENDLOOP.
IF SY-SUBRC 0.
MESSAGE I005.
ENDIF.
Hope this helps you.
Regards,
Tarun -
What are the XFA properties for a drop-down list?
I am having trouble distinguishing between the "Text" and "Value" for a drop down list.
I have a data drop-down list that is being populated by a database at runtime. I am using the "addItem" event while looping though the recordset. The "addItem" event takes 2 parameters:
param1: A valid string representing the value to display in the field.
param2: (Optional) A valid string representing the new items bound value. If empty, the default value is an empty string.
What is the corresponding XFA properties for param1 and param2?
If I want to reference "param2" somewhere else in the form, is it dropDownList.rawValue? is it dropDownList.value?reviewed the sample.zip form and xml file. The XML format is different from my file. Your file has one field named "item" with 3 records. <br /><data> <br />- <field> <br /> <item>1</item> <br /> <item>2</item> <br /> <item>3</item> <br /> </field> <br /> </data> <br /><br />My XML file has multiple fields and records. I need to populate the dropdown list with 1 field from XML file/DataConnection and bind the remainder of the DataConnection fields to the form fields. How can I achieve above with the sample example? <br />This is a portion of my xml file. <br /><?xml version = '1.0'?> <br /><ROWSET> <br /> <ROW num="1"> <br /> <ORG_OPER_NAME> U. S. OIL AND GAS, INC.</ORG_OPER_NAME> <br /> <ORGANIZATION_ID>6285</ORGANIZATION_ID> <br /> <OPERATION_TYPE_CODE>01</OPERATION_TYPE_CODE> <br /> <ORGOP_LINE_ID>1</ORGOP_LINE_ID> <br /> <ADDRESS1>P. O. BOX 9158</ADDRESS1> <br /> <CITY>HOUMA</CITY> <br /> <STATE>LA</STATE> <br /> <ZIP>703610000</ZIP> <br /> <CONTACT_NAME>ANTHONY P. AUTHEMENT</CONTACT_NAME> <br /> <PHONE_NUM>9858764651</PHONE_NUM> <br /> </ROW> <br /> <ROW num="2"> <br /> <ORG_OPER_NAME>103 TRUCK STOP, INC. </ORG_OPER_NAME> <br /> <ORGANIZATION_ID>101152</ORGANIZATION_ID> <br /> <OPERATION_TYPE_CODE>13</OPERATION_TYPE_CODE> <br /> <ORGOP_LINE_ID>1</ORGOP_LINE_ID> <br /> <ADDRESS1>4007 WHITE'S FERRY RD. </ADDRESS1> <br /> <CITY>WEST MONROE</CITY> <br /> <STATE>LA</STATE> <br /> <ZIP>712910000</ZIP> <br /> <CONTACT_NAME>103 TRUCK STOP, INC. </CONTACT_NAME> <br /> <PHONE_NUM>3183966200</PHONE_NUM> <br /> </ROW> <br /> <ROW num="3"> <br /> <ORG_OPER_NAME>3 S COMPANY</ORG_OPER_NAME> <br /> <ORGANIZATION_ID>5699</ORGANIZATION_ID> <br /> <OPERATION_TYPE_CODE>01</OPERATION_TYPE_CODE> <br /> <ORGOP_LINE_ID>1</ORGOP_LINE_ID> <br /> <ADDRESS1>RR #2, BOX 99</ADDRESS1> <br /> <CITY>EUREKA SPRINGS</CITY> <br /> <STATE>AR</STATE> <br /> <ZIP>726320000</ZIP> <br /> <CONTACT_NAME>NO CONTACT GIVEN</CONTACT_NAME> <br /> </ROW> <br /> <ROW num="4"> <br /> <ORG_OPER_NAME>3-T EXPLORATION, INC.</ORG_OPER_NAME> <br /> <ORGANIZATION_ID>6847</ORGANIZATION_ID> <br /> <OPERATION_TYPE_CODE>01</OPERATION_TYPE_CODE> <br /> <ORGOP_LINE_ID>1</ORGOP_LINE_ID> <br /> <ADDRESS1>BANKONE TOWER</ADDRESS1> <br /> <CITY>WICHITA FALLS</CITY> <br /> <STATE>TX</STATE> <br /> <ZIP>763082825</ZIP> <br /> <CONTACT_NAME>NO CONTACT GIVEN</CONTACT_NAME> <br /> </ROW> <br /> <ROW num="5"> <br /> <ORG_OPER_NAME>3-T OIL CO. INC.</ORG_OPER_NAME> <br /> <ORGANIZATION_ID>6395</ORGANIZATION_ID> <br /> <OPERATION_TYPE_CODE>01</OPERATION_TYPE_CODE> <br /> <ORGOP_LINE_ID>1</ORGOP_LINE_ID> <br /> <ADDRESS1>RT. 1, BOX 81</ADDRESS1> <br /> <CITY>WEIRGATE</CITY> <br /> <STATE>TX</STATE> <br /> <ZIP>759770000</ZIP> <br /> <CONTACT_NAME>NO CONTACT GIVEN</CONTACT_NAME> <br /> </ROW> <br /></ROWSET>
-
How to create conditional drop-down lists
I would like to create a form that utilizes conditional drop-down selection boxes like at http://blogs.office.com/b/microsoft-excel/archive/2009/11/24/create-conditional-drop-down- lists.aspx
How can I create a form that contains fields like this?
Is there a sample I can download?I have downloaded the AcroForm version (ListProgramming_Part1_AcroForm.pdf).
I'm not able to consistently recreate. I was first playing with the form by selecting values in the drop down. At one point I went to Document Javascripts and select "Example1". I chose to edit. Make no changes and select "OK" I get "SyntaxError: missing } in compound statement 39 at line 40"
The sec ion of code is:
function SetPartEntries()
// Only run this code on when the selection is commited.
if(event.willCommit)
// There are 3 rows in the order form so in order to use other fields in
// the same row we first have to acquire the name of the row
// we are operating on. This is part of the List field's name, so we
// just have to split it off
var cRowName = event.target.name.split(".").shift();
// Now get the new parts list from the Master List
// Since the selection is being committed, event.value contains the selection text
var lst = oAssemblyParts[event.value];
// If an entry is selected that we don't have a parts list for, then
// the parts list is just cleared.
if( (lst != null) && (lst.length > 0) )
this.getField(cRowName + ".PartSelect").setItems(lst);
else
this.getField(cRowName + ".PartSelect").clearItems();
// We have a new parts lists and the first entry is
// is a non-selection. so clear the price field.
this.getField(cRowName + ".Price").value = 0;
I am not able to recreate if I select "Edit all Javascripts" only when I use document javascripts.
Maybe you are looking for
-
Popups work in preview but not in compiled help
Hello, I am using Robohelp 8 and have been having problems displaying popups in my compiled help. When I view a topic that contains popup links in the WYSIWYG, I can preview the popup topics with no problem, but when I compile and click on a link tha
-
Problem deleting pdf files on network ressources when preview window of the explorer is enabled
Some of our customers have the Preview Function enabled in Windows Explorer. When they delete a pdf File on a network ressource (\\server1\share1\ for example) in Windows Explorer the file disappears, but will not be deleted immediately. After a refr
-
External mice don't function.
HP G62 Notebook PC Windows 7 64-bit Any external mice i attach to my laptop don't function. They still show up in the driver, but the buttons do not work and it doesn't move the cursor.
-
HT204088 How do I cancel a subscription that was set up to automatically renew?
I purchased a magazine subscription that apparently automatically renews. I don't care for the magazine and would like to stop it from renewing. How should I go about it?
-
Help! How to display everything on projector?
Hello, How to display everything in ipad on projector?