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,
Alka

Hi,
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,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • 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 &lt; 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,

  • Drop down list setSelected not working

    Hi all,
    I have a drop down list bound to a database (value: int, display: string). There are two pages:
    page 1: a table with id needed for page 2 (id passed through the url)
    page 2: drop down list bounded to a database. The selected value comes from page 1.
    Problem: Even though I am getting the correct value, and am using ddList.setSelected (id), the ddList value does not change.
    I basically want to know how to program the functionality of the "selected" property in java with a table bound to a database.
    Any ideas?

    Hi There,
    Looks like a user on this thread was able to set his drop down list value dynamically, take a look
    http://forum.java.sun.com/thread.jspa?forumID=881&threadID=5055898
    here is what the user comments
    Any way I have solved my problem
    1.Change the value field of dropdown from int to string, so value field and display fields are same.
    2. dropdown1.setvalue("abc");
    this solution will only work if the value field is String.
    Hope it helps
    Thanks
    K

  • Drop down list does not work in EPM

    Hi SAP Experts,
    One of my user is not able to view the Annual view in the EPM Report after selecting the Annual view option.
    When he selects the ‘Annual’ from the column D18, EPM does not display the Annual view.
    Still it shows the Monthly view in Row 24.
    Could you please guide me on how to fix this issue and what could be the reason.
    SAP_BW  RELEASE 731  SP LEVEL 0011
    BPC NW 10.0
    EPM 10.0 SP17 .NET 3.5
    Regards,
    Raj.

    Hi Jeff,
    Yes. It works for other users with additional team access.
    This is the first time, particular user tries. We have not made any changes to the report.
    Particular user has less access permissions when compare with other users.
    Regards,
    Rajesh.

  • I have Adobe Acrobat XI (ver 11.0.07).  Adobe Help instructs me to find the document comparison command at "View Compare Documents," however, this command does exist on my screen. My View drop-down list does not include a command for Compare Documents.

    I have Adobe Acrobat XI (ver 11.0.07).  Adobe Help instructs me to find the document comparison command at "View > Compare Documents," however, this command does exist on my screen. My View drop-down list does not include a command for Compare Documents.  Where else can I find this command?

    What version of Acrobat do you have? This feature is only available in the Pro version, not in the Standard version.

  • I am using Windows XP and just installed Elements 12. When I try to select a different brush or shape the drop down list will not stay open long enough to select a different item. I have used Elements 9 for awhile and have not had this problem

    I am using Windows XP and just installed Elements 12. When I try to select a different brush or shape the drop down list will not stay open long enough to select a different item. I have used Elements 9 for awhile and have not had this problem

    grannybel
    It would appear that you are destined for the Adobe Photoshop Elements Forum since your question is related to Photoshop Elements and not Premiere Elements which is the focus program where you have posted.
    But, while the arrangements are being made, here are a few things for you to think about if you have not already
    1. Reset Tools - Select Brush Tool, then
    2. Delete Settings File
    Go to Full Editor/Edit Menu/Preferences/General and click on the option "Reset Preferences on Next Launch".
    We will be watching for your progress.
    Thank you.
    ATR

  • Category drop down list does not show all taskes

    Hi, I created a project using product Upgrade Assitant for Release 12. I did not add any customized tasks. I just need to run the default tasks for upgrading 11i to r12. I did the setup following Maintenance Wizard User Guide Release 2 without any problem. But when I try to run the steps, the category drop down list only show one task: Configuration. Where are all other categories? Thanks

    Hi, Thank you for the reply. I did successfully finished all the 4 tasks for the configuration category without any errors. I want to continue with other tasks. But the drop down list does not show anything else except Configuration. From the user guide:
    Important Notes:
    • To view the full list of categories applicable to your installation, you must complete all of the steps in the Configuration category. When you complete these steps, you must refresh the lower left pane of your Web browser. The entire list of categories appears.
    What does this mean "you must refresh the lower left pane of your Web browser". I don't see anything to be refreshed. But even after I restarted mw (it must be refreshed now), the category list still now shown.

  • Reg: Drop-Down list Box not  displaying values

    Hi Experts,
                     i am publishing a module pool program in the internet using SICF Transaction . In the internet my drop down list box is not displaying the default value  but in my sap it works fine .
    What may be the problem?
    Regards,
    Vikram

    Hello Thorsten Domsalla ,
                      My Problem is in my sap module pool program there is a drop down list box which disaplays  default values its working fine in sap gui but when i access through internet (SICF) Transaction the Drop down list box not listing out default values .
    i am using Integrated ITS Version 7.0 and Support package 08.
    Regards,
    Vikram

  • Drop down boxes are not working in joomla

    on a joomla website which i am an admin for actually i am an admin for multiply one but the drop down boxes are not working on any of them it is kind of being a pain

    Are there any error messages in the Web Console (Firefox/Tools > Web Developer) about this?
    *https://developer.mozilla.org/Tools/Web_Console

  • Excel Cells that are 'Pick from drop down list" could not be read through ADODB.recodset

    Dim ExcelConn As ADODB.Connection
            Dim ExcelRs As ADODB.Recordset
            Dim iidx As Integer
            Set ExcelConn = CreateObject("ADODB.Connection")
            ExcelConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\RRAJENDRAN\Desktop\Final Report Template.xls; Extended Properties=""Excel 8.0;HDR=YES;"""
            ExcelConn.Open
            iidx = 2
            Set ExcelRs = CreateObject("ADODB.Recordset")
            ExcelRs.Open "Select * FROM [Input$]", ExcelConn, 1, 3
            Do While Not ExcelRs.EOF
                    Select Case iidx
                        Case 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
                            Debug.Print iidx & ":" & ExcelRs.Fields(18).Value
                    End Select
                ExcelRs.MoveNext
                iidx = iidx + 1
            Loop
            ExcelRs.Close
            ExcelConn.Close
    The blank values correspond to cells that are drop -down lists
    8:
    9:8/11/2014
    10:8/14/2014
    11:8/15/2014
    12:
    13:
    14:
    15:
    16:
    17:
    18:
    19:
    Raju Rajendran

    Hi Raju,
    Base on my test in excel 2013, it works fine.
    Create a new excel file and save as xls
    Add data (data validation for dropdownlist)
    What’s the version of your excel? Could you reproduce that issue in a new file? You may share the sample file on the OneDrive.
    Regards
    Starain
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • 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 you

    Hi,
    can you share the solution,even i was trying to archive the same.Thanks in advance.

  • Multi-Select (drop down list) data not saving upon save/email

    I have created a drop down list and modified it to allow multiple selection, i.e.
    form1.BusinessAreaTable[1].Row1[4].ERP::ready:form - (JavaScript, client)
    this.ui.choiceList.open= "multiSelect"; this.rawValue
    = "-1"
    However, when I go to save the form and/or email the list fields erase and the data / items I selected are gone.
    Please help, thanks.

    Okay, I have the form now.
    You are using script in the form Ready event to make a dropdown list mimic a listbox. This is totally unnecessary. I have changed the ERP to a multi-select listbox in the Object > Field palette and commented out the script.
    Here is the form: https://acrobat.com/#d=K*P4xKIA4kkqEHGTpgyvvw
    The form has not been Reader Enabled, so user with Reader will not be able to save the data inputted or submit by email in PDF format:
    Summary here:
    http://assurehsc.ie/blog/index.php/2010/05/using-livecycle-forms-in-acrobat-and-reader/
    Niall

  • 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.G

    Hi,
    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 Will Not Delete

    How to clear the awesome bar drop down list. I delete them one by one, yet they are still there. Any suggestions?

    Yes this is a bug with Dynamic Forms in 7. There was a post before with a workaround -
    Custom Text disappears on exit when using Dynamic Forms

  • Drop-down list will not allow custom entry

    I've got a drop down list on my form, with the 'Allow Custom Text Entry' checkbox checked. However, when I attempt to type in custom text, as soon as I focus away from the drop down via tab or clicking on another element, the text that I typed in disappears. The only text that I can get to submit is what is contained in the pre-defined list items. However, when I create a new form with nothing but the drop-down, it works fine...

    Yes this is a bug with Dynamic Forms in 7. There was a post before with a workaround -
    Custom Text disappears on exit when using Dynamic Forms

Maybe you are looking for

  • APEX 4.0 Getting gReport is undefined when pulling IR report from Page2

    The below function used work perfectly in APEX 3.2 for Pulling Page2 IR Report into Page1 Region having <div id="XXHOLDER"> <div> but in APEX 4.0, I am getting "gReport is undefined" when I click on IR Toolbar/Control panel like Action or Go function

  • Looking for a WebObjects Developer

    Not a technical question, but I think this is relevant to the list. If not, please let me know. I am undertaking a new project, and am looking for a WebObject/Wonder developer to work with. If you know me, you know I went through an unfortunate (and

  • Though i cleared GL by F.13, still in fbl3n report items are showing in red

    Hi Experts, Though i cleared the gl line items up to the date through f.13,but when i run the fbl3n report up to the date, items are showing in red.& balance is zero.please advice

  • Connect my camera

    Hello Can I get a lead for my analog video camera to record video onto my mac? Hope someone can help! Cheers Ed

  • How can you get an image's resolution information in OS X 10.3?

    In Windows Explorer you can see an image's size and resolution by right-clicking on it and looking at its properties. Is there any way you can get this image information in Finder or by running an AppleScript? Thanks in advance, Daniel Message was ed