Using Javascript to require 2 drop down menus to have something selected

Hi everyone. I'm trying to get 2 drop down menus to each have something selected when the form is submitted. I'm using javascript for this, but I can't get it to work. Basically, if one is blank and the other one isn't, I want an error to pop up saying they have to fill in the one that is blank and vice versa. What am I doing wrong? Here's what I have for the javascript and on the form below. My 2 drop down names are Mfg_Spec_Prod_Approval_Initials and Mfg_Spec_Prod_Approval_Rev. Thanks for anyone's help!
Andy
<SCRIPT LANGUAGE="JavaScript">
        function verify() {
            var partNumber = '';
            var ecoNumber = '';
            var ProdInit;
            var ProdInitValue='';
            var ProdRev;
            var ProdRevValue='';
            var allArray = document.getElementById('listofids').value.split(",");
            var error=false;
            for(var i=0;i<allArray.length;i++) {
                ProdRev = document.getElementById('Mfg_Spec_Prod_Approval_Rev'+allArray[i]);
                ProdInit = document.getElementById('Mfg_Spec_Prod_Approval_Initials'+allArray[i]);
                ProdRevValue = ProdRev[ProdRev.selectedIndex].value;
                ProdInitValue = ProdInit[ProdInit.selectedIndex].value;
<!--- This code is if the BOM Initials is not empty and the PNR Initials is empty.--->
                if(ProdInitValue != '' && ProdRevValue == '') {
                    error=true;
                    ecoNumber = document.getElementById('ECID'+allArray[i]).value;
                    partNumber = document.getElementById('Part_Number'+allArray[i]).value;
                    alert("You must enter a Rev for ECO " + ecoNumber + " Part Number: " + partNumber);
                else if(ProdRevValue != '' && ProdInitValue == '') {
                    error=true;
                    ecoNumber = document.getElementById('ECID'+allArray[i]).value;
                    partNumber = document.getElementById('Part_Number'+allArray[i]).value;
                    alert("You must enter your initials for ECO " + ecoNumber + " Part Number: " + partNumber);
            if(error) {
            return false;
        else {
            return true;
    </script>
Start of form
<cfform name="EditItem" method="post" action="My_Machining_action.cfm" onsubmit="return verify();">
<cfset MfgSpecProdInitials = DocumentationSearch.Mfg_Spec_Prod_Initials>
<td align="center">
<cfif Mfg_Spec_Prod_Initials Is Not ""<!---  and Mfg_Spec_Prod_Initials EQ cookie.UserInitials --->>
<select name="Mfg_Spec_Prod_Approval_Initials#ItemID#" id="Mfg_Spec_Prod_Approval_Initials#ItemID#">
<option value=""></option>
<cfloop query="ShowProdInitials">
<option value="#Initials#"
<cfif #Initials# EQ MfgSpecProdInitials>selected</cfif>>#Initials#</option>
</cfloop>
</select>
<cfelse>
</cfif>
</td>
<cfset MfgSpecProdRev = DocumentationSearch.Mfg_Spec_Prod_Rev>
<td align="center">
<cfif Mfg_Spec_Prod_Initials Is Not ""<!---  and Mfg_Spec_Prod_Initials EQ cookie.UserInitials --->>
<select name="Mfg_Spec_Prod_Approval_Rev#ItemID#" id="Mfg_Spec_Prod_Approval_Rev#ItemID#">
<option value=""></option>
<cfloop query="ShowDocRevChoices">
<option value="#Doc_Rev_Initials#"
<cfif #Doc_Rev_Initials# EQ MfgSpecProdRev>selected</cfif>>#Doc_Rev_Initials#</option>
</cfloop>
</select>
<cfelse>
</cfif>
</td>
<input type="submit" value="Update">

Eddie,
   I actually got this javascript below to work so if one drop down is left blank, and the other one is filled out, an error will pop up saying to entering either some initials or a rev. The only problem is that I have a dynamic list of drop downs in rows, so I need this javascript to run for each row. If I do the 1st row with 1 drop down selected and the other not, it gives me the error, which is perfect. But if I want the 2nd row to error out, for instance, doing the same thing, the error will not pop up. How do I make this work so it does this for each row since the list of drop downs is dynamic? My drop down menu names are Mfg_Spec_Prod_Approval_Initials and Mfg_Spec_Prod_Approval_Rev.
<script type="text/javascript">
                    function verify() {
                        var Mfg_Spec_Prod_Approval_Initials = document.getElementById('Mfg_Spec_Prod_Approval_Initials');
                        var Mfg_Spec_Prod_Approval_Rev = document.getElementById('Mfg_Spec_Prod_Approval_Rev');
                        if(Mfg_Spec_Prod_Approval_Initials.selectedIndex == '' && Mfg_Spec_Prod_Approval_Rev.selectedIndex != '') {
                            alert('select Initials!');
                            return false;
  else if(Mfg_Spec_Prod_Approval_Rev.selectedIndex == '' && Mfg_Spec_Prod_Approval_Initials.selectedIndex != '') {
                            alert('select a Rev!');
                            return false;
                        return true;
                </script>
Andy

Similar Messages

  • Drop down menus flicker; hard to select a menu item

    When I select a drop down menu - Feedback, say, the drop down flickers in and out of visibility as I move down the menu. I can select an item, even though I can't see it, but it is hard to use menus I'm not familiar with. Same thing happens in the address bar with the drop down address 'help' - the bar constantly flickers in and out, and, in this case, when I attempt to use the drop down, the menu items disappear just as my mouse approaches them, then reappear as the mouse moves to the next item.
    I have tried this with all addons (I don't have many) disabled. I have tried the nightly build. Nothing has fixed this problem so far.
    Too bad, since I'm definitely liking the speed and the new look.
    I would consider this a showstopper. I'm amazed that it hasn't been reported before.

    Solved. After browsing through the forum, I found the solution. I have an Nvidia graphics card, and disabling hardware acceleration did the trick.

  • Reader drop-down menus have invisible content

    I'm running 9.4.7 on Ubuntu 11.10. The Reader drop-down menus either have no text in them or the text is the same colour as the background. I've tried changing the Ubuntu theme but the problem remains.

    Found an option to make the workaround permanent.
    Run Terminal.
    Paste this "cd /etc/X11/Xsession.d" (no quotes).
    A edit file would open separately.
    Paste this "export UBUNTU_MENUPROXY="acroread":$UBUNTU_MENUPROXY" in the Editor window.
    Save the File.
    Exit Terminal.
    Do a fresh Login.
    The menu option would appear below the Taskbar but would be working.
    Tested in Ubuntu 11.10 with Reader 9.4.7
    Source: http://ubuntuforums.org/showthread.php?t=1821458

  • Creating drop down menus in JSP using custom tags

    Hi, i am working on a JSP which has custom tags for displaying menubar and menus, now i want to have these menus converted into drop down menus, and the submenus displayed onmouseover event. I am getting solutions with pure html page calling javascript functions.But i dont need this, i want the work done by my TagHandler class which sends the output to output stream, which in turn is transformed in to actual HTML by a XSLT embedded in my JSP.
    Please help as i am new to custom tags, and desperately in need of help.
    If possible give some sample code or useful links.
    I will be highly grateful.
    Thankx in advance

    that's fine, but the tag has to, ultimately, generate the HTML/Javascript stuff like you've already seen.

  • Drop down menus on iPad, the first selection in the drop down will not load as a selection when using safari, what can I do?

    Drop down menus on iPad, the first selection in the drop down will not load as a selection when using safari, what can I do?  I use this for my mobile, on-site auto repair business and not being able to call up repair and diagnostic info and reference for some cars is troublesome for sure. It works fine on the computer and I have installed a remote desktop app as a workaround but it is unreliable because the desktop is not business dedicated and may be off or in use at the time. So is there a known fix for this?
    Let me paint a more descriptive picture, visualize 4 drop down selection menus, first one is for year, next one is for make, 3rd one is model and the last one is for engine size/type. If I wanted to choose a 2012 vehicle it wont work because it is the top selection on the list. This can be forced by selecting any other year and then coming back to 2012. Ok fine, but then let's say I wanted to choose Acura as the make, well it won't take it because again it's the top selection. Again you work around it be selecting any other make and coming back to Acura. Ok now select the model, same trend follows. But now since most Acura vehicles come with dedicated engines and no optional engines I have only 1 selection in that final drop down menu and it will not take my selection and therefore never let me proceed to the info I need.
    This is also true when ordering parts from my wholesaler's website, they use drop downs and I can only get to that last drop down and then I'm stuck. This is blindingly frustrating, what options do I have. I'm not opposed to any avenue at this point.

    Did you ever figure this out? I bought my iPad last week to use in my business as well. I assume you are trying to use alldata? That is where I noticed this same issue. I had problems with identifix working with safari but downloaded a different browser and that works fine. Alldata does not work with either browser. The main difference is that on identifix if there is only one engine selection, it automatically selects the only option and continues to the home page. With alldata you have to make the selection manually even if there is only one option. Honestly if I can't get this to work I am going to return the iPad as it looses a significant amount of usefulness to men

  • I am having some serious issues with firefox, i can't print anything because it is stuck on fax and I can't use any of the drop down menus on any site

    I am having some serious issues with firefox to the point of choosing another search engine. I can't print anything because it is stuck on fax and won't let me change it to my printer when i do try to select my printer it jumps right back to fax. The drop down menus do not work on any of the sites I go to. For example when purchasing clothes and you have to choose a size from a drop down menu I can't do it when I click on the drop down menu it doesn't work at all. I don't have a virus I ran my virus protector and no viruses are present. I don't have any suspicious issues going on with my computer so there has to be something in Firefox that is causing my issues. I tried internet explorer and I don't have any issues there. I hope you can help me because I love Firefox and would really like to continue to use it.

    Lots of issues there, main one getting fcpx going again, try deleting the preferences using the utility deveoped by these guys.
    http://www.digitalrebellion.com
    Try deleting your render files and re-rendering the project.
    Start with these and let us know how you go.
    Tony

  • The drop down menus in Photoshop CC 2014 are too small to read without using the magnifier.  They are OK in Photoshop CC.  I have been unable to find anyplace to adjust the font size.  I have Windows 7 Pro.  Looking at the Photoshop version history, it lo

    The drop down menus in Photoshop CC 2014 are too small to read without using the magnifier.  They are OK in Photoshop CC.  I have been unable to find anyplace to adjust the font size.  I have Windows 7 Pro.  Looking at the Photoshop version history, it looks like this problem comes and goes as Photoshop is updated.  It should be an easy fix.

    Try the Photoshop CC 2014 Preference experimental section 2X UI option

  • Fire fow will not let me use curtain buttons and drop down menus for web sites. i had version 7.01 and upgraded to verson 8.02b and it did it on both of them. and the web pages work find if i use chrome

    Firefox will not let me use curtain buttons and drop down menus for web sites. i had version 7.01 and upgraded to verson 8.02b and it did it on both of them. and the web pages work find if i use chrome

    Do a clean reinstall and delete the Firefox program folder before (re)installing a fresh copy of the current Firefox release.
    Download a fresh Firefox copy and save the file to the desktop.
    *Firefox 21.0.x: http://www.mozilla.org/en-US/firefox/all.html
    Uninstall your current Firefox version, if possible, to cleanup the Windows registry and settings in security software.
    *Do NOT remove personal data when you uninstall your current Firefox version, because all profile folders will be removed and you will lose all personal data like bookmarks and passwords from profiles of other Firefox versions.
    Remove the Firefox program folder before installing that newly downloaded copy of the Firefox installer.
    *(32 bit Windows) "C:\Program Files\Mozilla Firefox\"
    *(64 bit Windows) "C:\Program Files (x86)\Mozilla Firefox\"
    *It is important to delete the Firefox program folder to remove all the files and make sure that there are no problems with files that were leftover after uninstalling.
    *http://kb.mozillazine.org/Uninstalling_Firefox
    Your bookmarks and other personal data are stored in the Firefox profile folder and won't be affected by an uninstall and (re)install, but make sure that "remove personal data" is NOT selected when you uninstall Firefox.
    If you keep having problems then also create a new profile.
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    *http://kb.mozillazine.org/Profile_backup
    *http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Clean_reinstall

  • Problems using drop down menus in safari v7

    I am having problems using drop down menus in safari v7. e.g. on the BMW used cars website (http://usedcars.bmw.co.uk), there's a drop down box for location. This only goes up to 50 miles on my macbook but goes up to national on my iPad. Any ideas?

    Thanks Peter, Dale. Looks like it is back to the drawing board for me then!
    I tried to import it through MS Word but iPad doesn't support the document.  Looking into converting document into a Numbers spreadsheet as it has drop down boxes but unfortunately need to buy the £6.99 numbers app for iPad to make it worthwhile. Might just stick to good old fashioned "cross out the answers that don't apply" using pen and paper..................

  • Does anybody know why I am unable to use drop-down menus on my mac?

    I dont know if its a mac book problem or just me, but I can't get any drop-down menus to work? When I click on the arrow nothing happens! Can anyone help as I am unable to log out of email, facebook etc.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • Drop down menus / search engine friendly

    Hi,
    I've been tasked with creating a new company website and having it go live April 10th. I would like to use iWeb to get it done.
    Are drop down menus possible with iWeb? To be clear, I'm talking about if you hover your cursor over a menu item; say products, a drop down menu will appear listing specific products and link to that products page.
    The other main requirement is that the site be search engine friendly. Our current website is in Flash and is virtually invisible to search engines.
    I hope that these questions haven't been answered by digging just a little further, it's just that I'm under a tight deadline and must get started.
    I've been a Mac user since 88 and I would like to work on my preferred platform. I've got a decent background in design. (I'd like to not use Dreamweaver under this deadline) Our current website is www.rapid.com. It was made from a flash template that I was told to use so I made the best of it.
    I'm going for a clean looking non fussy user experience, unlike what we have now.
    Thanks for any help you may have.

    As Massimo says, they are just fine in the basic sense.
    The adminition you are familiar with was related to *any*
    menu system that
    embedded your actual menu links within javascript
    'document.write' commands,
    just the way the DW pop-up menus prior to CS3 does, and the
    way the FW
    pop-up menus prior to FW8 did.
    If you can look at the HTML on the psge, and SEE the links in
    the HTML, then
    a search engine will also be able to see them, and therefore
    spider your
    site.
    BUT - if you have sub-menus, and I have javascript disabled,
    *I* will not be
    able to access those sub-menu links when I come to your site.
    Further,
    neither will anyone with a screen reader. That's a
    problem....
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Triplets" <[email protected]> wrote in
    message
    news:f344rd$olm$[email protected]..
    > In the past one was discouraged to not use javascript
    anf DHMTL menus
    > since they are not search engine friendly. How about the
    new CS3 Spry
    > Menus?

  • Dynamically updating a value based on drop down menus

    Hi,
    I am trying to make a website for a new computer company.
    Part of the website allows you to choose different componets, like
    the Dell website. It has different drop downs like CPU, Case,
    motherboard etc which list the option we have chosen then it gets
    all of the records from each database. So for CPU it checks to see
    what motherboard is selected and displays all of the CPUs that are
    compatible with that bpard from the CPU data base.
    It has the price at the bottom of the page which is
    calculated by adding all the prices of the drop down menus together
    but if I change an option it doesn't change the price.
    How can I have the price dynamically change based on
    different values being selected from the drop down boxes?
    Thanks for any help
    Lewis

    You'd do some kind of onChange with the select. Get the value
    of the current index in the select and pass that over to whatever
    needs it.
    Using a JavaScript framework may be best and easiest - like
    jQuery. It allows you to do stuff like this quite easily. Though
    I'm no expert either - just getting into it.
    Are these chained selects then? I also think there's a CF
    only version / custom tag out there for this - but it would require
    a page refresh everytime the list is changed.
    You could also use AJAX I guess.
    Cheers,
    Mikey.

  • DW-MX-04 Drop-down menus won't work.

    I'm using Dreamweaver MX 2004 (have been for several years, so I know my way around it).  I want to create drop-down or fly-outs menu's to consolidate page links into categores in order to reduce the number of link tabs I have on each page.  I've been able to create the menu's I needed (using: Tag Chooser\ Behaviors\ Show Pop-U Menu), but when I preview the pages in IE, the text only shows on the mouseover text (not on top) despite having the text color set as black in the Menu window.  But it gets worse.  When I uploaded the page to try it, the drop down menus don't show up at all when I hover over the main buttons and  I get javascript errors.
    Can anyone give me so assistance on how to resolve this?
    I've checked the text color issue using the code view editing pane, and it matches the way I have it setup in the Pop-Up Menu.  But that's the least of my worries if I can't get them to work at all when the pages are live.
    Thanks...JEB

    MX2004 software is also somewhat antiquated and no longer supported by Adobe.   So it shouldn't surprise you that the tools from nearly a decade ago are obsolete today.  The web itself has changed significantly since 2004! 
    Web standards have moved from HTML3 to HTML5.  Layouts have departed from old school nested tables to more efficient CSS.  Unlike a decade ago, today's web devices include everything from hand held smartphones & tablets to laptops, desktops and TV displays.  So it's not possible to stand still and keep pace with the evolving web.  If you're not moving forward, you're falling behind.
    CSS is not an extension.  HTML = content.  CSS = Cascading Style Sheets.  CSS is used to style your content.    With CSS you can make an ordinary list look like a very cool menu with buttons, borders, shadows, drop-down and rollover effects.  If you master CSS, you can do some very creative things with it.  However, coding skills are essential.
    Below is an example of an unordered list styled with CSS to make a nice horizontal drop-menu.
    http://alt-web.com/DEMOS/CSS-Multi-colored-drop-menu.shtml
    To further illustrate the efficiency and power of CSS, look at CSS Zen Garden. 
    http://www.csszengarden.com/
    Every page on the right panel contains exactly the same HTML code as the first.  The only difference is the CSS code.
    The shift to CSS is intended to help web designers keep styles separate from content. Learning to work with CSS will make a you better web designer and save countless hours of tedious re-coding when you decide to change the look of your site.  It's much easier to edit one file instead of many. 
    Below are some links to help you learn more about how to work with CSS.
    HTML & CSS Tutorials -
    http://www.html.net/
    http://w3schools.com/
    http://www.csstutorial.net/
    https://tutsplus.com/2013/03/the-modern-web-designer/
    Have fun!
    Nancy O.

  • Multiple drop down menus won't work

    Hi guys,
    Mac newbie here: I decided to give them a shot after a lifetime of PC use due to a friend's recommendations.
    I'm trying to apply for jobs, and every single site that has two drop down menus, with one dependent on the other, won't work in Safari. (if I go try it out on a PC with IE, it works without any problems). For example, a menu that reads "country" and the next one reads "state". It will let me choose the country, but then the "state" one won't work at all, with the only option being "choose one".
    As these are required fields to send the application along, I'm having to borrow someone else's computer every time I apply for a job, and that's getting old fast. Any ideas on how to get Safari to quit hanging up on the dropdowns?
    I have no idea if this matters or not, but I bought my Mac when I lived in Japan. I'm still running the English version of the OS, though.
    Thanks for any help you can give me!

    I use www.alldatapro.com for auto repair information. It a members only site so it might be a bad example. The problem im having is, i cant select the first option in any dropdown menu. The badpart about that is some of the menus only have one option. In such a case, i have to log in on regular computer, put the info in, then reload the website on the ipad so i can use the "previous vehicles" option. I have a jailbroken ipad running 4.3.1. The dropdown mnus worked perfect until i upraded to 4.2 and i still havent found the source.

  • Making drop down menus in server side includes

    Can drop down menus be part of a server side include? If not,
    how do I have drop down menus in my pages without copying the code
    to all the pages individually?
    I am working in Dreamweaver 8 on a Mac. I've made the drop
    down menus using the behaviors window. Everything is fine in the
    original html file. When I use the file as an include in my main
    page, the javascript drop downs do not work. I have the style sheet
    used in the drop down file attached to the main page. What do I
    need to do with the main page to have the drop down menu work? I
    need to use this drop down on the majority of my pages. Thanks!
    Note: I've taken out the extra code in the include file
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head> <meta http-equiv="Content-Type" content="text/html;
    charset=ISO-8859-1" /> <title>Untitled
    Document</title></head><body></body></html>

    > Can drop down menus be part of a server side include?
    Sure - it's the only way I do them.
    > I've made the drop down menus using the behaviors window
    That's too bad. You will want to read this -
    http://www.losingfight.com/blog/2006/08/11/the-sordid-tale-of-mm_menufw_menujs/
    There are MUCH better ways -
    Check the uberlink and MacFly tutorials at PVII -
    http://www.projectseven.com/
    and the Navbar tutorial/articles at Thierry's place
    http://tjkdesign.com/articles/dropdown/
    Or this one (more recent article):
    http://tjkdesign.com/articles/Pure_CSS_Dropdown_Menus.asp
    Or to get it done fast, go here -
    http://www.projectseven.com/tutorials/navigation/auto_hide/index.htm
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "aacjp" <[email protected]> wrote in message
    news:[email protected]...
    > Can drop down menus be part of a server side include? If
    not, how do I
    > have
    > drop down menus in my pages without copying the code to
    all the pages
    > individually?
    >
    > I am working in Dreamweaver 8 on a Mac. I've made the
    drop down menus
    > using
    > the behaviors window. Everything is fine in the original
    html file. When I
    > use
    > the file as an include in my main page, the javascript
    drop downs do not
    > work.
    > I have the style sheet used in the drop down file
    attached to the main
    > page.
    > What do I need to do with the main page to have the drop
    down menu work? I
    > need
    > to use this drop down on the majority of my pages.
    Thanks!
    >
    > Note: I've taken out the extra code in the include file
    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN"
    > "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html
    > xmlns="
    http://www.w3.org/1999/xhtml">
    <head> <meta
    > http-equiv="Content-Type"
    > content="text/html; charset=ISO-8859-1" />
    <title>Untitled
    >
    Document</title></head><body></body></html>
    >
    >

Maybe you are looking for