How to Handle Modal Dialog Alert

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How to Handle Modal Dialog Alert

mhans
Anyone any idea about how to verify alert which is present on modal
dialog popup???
I tried command like selenium.isalertPresent() and
driver.switchto().alert() but
no luck.
Is this bug??
Reply | Threaded
Open this post in threaded view
|

Re: How to Handle Modal Dialog Alert

softwaretestingforum
Administrator
This looks confusing - " alert which is present on modal dialog"
Are you just referring to alert here?
Also do you encounter any error when you use switch To?
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: How to Handle Modal Dialog Alert

mhans
"Alert present on modal dialog"----when you clicked on links which is open popup window using window.open or window.showmodaldialog for opening popup.
if popup open with window.open then window().alert() working fine for handling alert present on it. but if popup open with window.showmodaldialog then window().alert() is not working with alerts on popup and console print noalertpresent exception.
Reply | Threaded
Open this post in threaded view
|

Re: How to Handle Modal Dialog Alert

mhans
Hi tarun...... still waiting for your response regarding the same....
Reply | Threaded
Open this post in threaded view
|

Re: How to Handle Modal Dialog Alert

softwaretestingforum
Administrator
Sorry mhans, but I am not sure of solution. I could have tried more if I had access to application.
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: How to Handle Modal Dialog Alert

mhans
hey tarun u need not to feel sorry......on skype conversation u suggested me to use robot class to get alerts....i used the same class and got positive result but i want to verify these alerts for validate mandatory fields.

u know tarun i m much sure this is still a bug in selenium.
Reply | Threaded
Open this post in threaded view
|

Re: How to Handle Modal Dialog Alert

softwaretestingforum
Administrator
then I would suggest to file it here with all relevant details
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: How to Handle Modal Dialog Alert

mhans
Selenium version--2.22
OS--Window(XP,7)i tried on both.
browser--IE 7,8,9
language--java
webdriver code---
 String currentWindowHandle =driver.getWindowHandle();
      System.out.println(currentWindowHandle);
      driver.findElement(By.cssSelector("#employmentGrid >
thead.WhiteBk > tr > td.SectionHead > span > a")).click();
      java.util.Set<String> availableWindows
=driver.getWindowHandles();
      System.out.println(availableWindows.size());
      int Windows = 2;
      if (availableWindows.size()==Windows) {
      String popUpWindowHandle = null;
      for (String windowHandle2 : availableWindows) {
          if(!availableWindows.equals(currentWindowHandle))
                 popUpWindowHandle= windowHandle2;
                  driver.switchTo().window(popUpWindowHandle);
                 System.out.println(driver.getTitle());
                  driver.findElement(By.name("submit")).click();
                  Alert alt= driver.switchTo().alert();
                   System.out.println(alt.getText());
                   alt.accept();}}}
Modal Dialog source--
<HTML> 
<HEAD> 
<div id="ContextMenu"
        style="{display: none; z-index:99999; position:absolute;}"> Cut Copy Paste</div> 
<iframe id="contextFrame" src="javascript:false;" scrolling="no"
        frameborder="0"
        style="position:absolute; top:0px; left:0px; display:none;"></iframe> 
<script language="javascript" src="Javascript/Global.js"></script>  <script language="javascript" src="Javascript/wz_tooltip.js"></script>  <script language="javascript" src="Javascript/jquery-1.4.2.js"></ script> <script type="text/javascript" src="Javascript/jquery.tablesorter.js"> </script>  <LINK rel="stylesheet" href="theme/jquery-ui-1.8.5.custom.css"
        type="text/css" /> 
<script Language="javascript" src="Javascript/jquery- ui-1.8.5.custom.js"></script>  <script Language="javascript" src="Javascript/Menu.js"></script>  <META http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1"> 
<META name="GENERATOR" content="IBM Software Development Platform"> 
<META http-equiv="Content-Style-Type" content="text/css"> 
<META http-equiv="expires" content="Thu May 31 12:44:29 EDT 2012"> 
<META http-equiv="no-cache"> 
<TITLE> 
Add Employment History</TITLE> 
                <LINK href="theme/Master.css" rel="stylesheet" type="text/css"> 
<LINK rel="stylesheet" href="css/alternative.css" type="text/css" /> 
<script language="javascript" src="Javascript/StrutsValidation.js"></ script> </HEAD> <BODY scroll="no" onresize='sizeTiles(false, true)' onload='setDivParam("pagename.addemploymenthistory", true, false)' onBeforeUnload="return doUnload();" onmousemove="moveProcessing(event)" onContextMenu="return false;"> <script> //start the session timer sessionTimeOutMins=7200/60; dblMinutes = 115; setSessionTimeOutAlertTimer(); document.onkeydown = disableCtrlN; showProcessingWheel (); document.onreadystatechange = stopProcessing; //document.onmousemove = moveProcessing; function stopProcessing(){ hideProcessingWheel (); } </script>                                                                                                                                                                                                                                                                                                                             
<a href="#" title="Online Help" onclick='showHelp("UI/Help/Employment_List.htm#Adding Employment History")'>Help
  <DIV style="display:none" id="LinkDivId"> 
<DIV class="divText">Click on the links below to perform any of the
listed operations for this producer</DIV> 
<br> 
</DIV> 
<DIV id="masterDiv" style='overflow: auto;'> 
<form name="employmentBean" method="post" action="/PCRMVERSIONPREVIEW/
employmentHistoryAction.do" onsubmit="return submitPopupForm(this)"> 
        <input type="hidden" name="mode" value="1"> 
        <input type="hidden" name="actionMode" value="2"> 
        <input type="hidden" name="formId" value="0"> 
        <input type="hidden" name="licenseeId" value=""> 
        <input type="hidden" name="parentBean" value="maintainProducer"> 
        <input type="hidden" name="appliedEmployment" value="false"> 
        <input type="hidden" name="appliedEmpProfile" value="true"> 
                          <colgroup> 
                        <col width="18%" /> 
                        <col width="20%" /> 
                        <col width="13%" /> 
                        <col width="20%" /> 
                        <col width="13%" /> 
                        <col width="*" /> 
                </colgroup> 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <input type="hidden" name="startDate" value=""> 
                        <input type="hidden" name="endDate" value=""> 
                                                                                                                                                                                                                                                                                                                                                                             
Employment Detail
Employer Name
                                                * 
                               
                                                  <input type="text" name="employerName" maxlength="100" value=""
class="inputCompanyName"> 
                               
Present Employer<input type="checkbox" name="currentEmployer"
value="on" onclick="validateEndDate(this.form);">
Supervisor                                          <input type="text" name="supervisor" maxlength="100" value=""
class="inputCompanyName"> 
                               
Position Held
                                                        * 
                               
                                                  <input type="text" name="positionHeld" maxlength="25" value=""
class="inputTextField"> 
                               
From
                                                        * 
                               
<select name="startDateMonth"
onchange="updateHiddenFields(this.form)"
class="inputSmallMediumCombo"><option value=""></option> 
                                        <option value="01">January</option> 
                                        <option value="02">February</option> 
                                        <option value="03">March</option> 
                                        <option value="04">April</option> 
                                        <option value="05">May</option> 
                                        <option value="06">June</option> 
                                        <option value="07">July</option> 
                                        <option value="08">August</option> 
                                        <option value="09">September</option> 
                                        <option value="10">October</option> 
                                        <option value="11">November</option> 
                                        <option value="12">December</option></select> <select
name="startDateYear" onchange="updateHiddenFields(this.form)"
class="inputSmallYearCombo"><option value=""></option> 
                                        <option value="2012">2012</option> 
<option value="2011">2011</option> 
<option value="2010">2010</option> 
<option value="2009">2009</option> 
<option value="2008">2008</option> 
<option value="2007">2007</option> 
<option value="2006">2006</option> 
<option value="2005">2005</option> 
<option value="2004">2004</option> 
<option value="2003">2003</option> 
<option value="2002">2002</option> 
<option value="2001">2001</option> 
<option value="2000">2000</option> 
<option value="1999">1999</option> 
<option value="1998">1998</option> 
<option value="1997">1997</option> 
<option value="1996">1996</option> 
<option value="1995">1995</option> 
<option value="1994">1994</option> 
<option value="1993">1993</option> 
<option value="1992">1992</option> 
<option value="1991">1991</option> 
<option value="1990">1990</option> 
<option value="1989">1989</option> 
<option value="1988">1988</option> 
<option value="1987">1987</option> 
<option value="1986">1986</option> 
<option value="1985">1985</option> 
<option value="1984">1984</option> 
<option value="1983">1983</option> 
<option value="1982">1982</option> 
<option value="1981">1981</option> 
<option value="1980">1980</option> 
<option value="1979">1979</option> 
<option value="1978">1978</option> 
<option value="1977">1977</option> 
<option value="1976">1976</option> 
<option value="1975">1975</option> 
<option value="1974">1974</option> 
<option value="1973">1973</option> 
<option value="1972">1972</option> 
<option value="1971">1971</option> 
<option value="1970">1970</option> 
<option value="1969">1969</option> 
<option value="1968">1968</option> 
<option value="1967">1967</option> 
<option value="1966">1966</option> 
<option value="1965">1965</option> 
<option value="1964">1964</option> 
<option value="1963">1963</option> 
<option value="1962">1962</option></select>(month/year)
                                          <div id="toDateYes" style='display:block'></div> 
                                        <div id="toDateNo" style='display:none'></div> 
                                        To
                                                        * 
<select name="endDateMonth"
onchange="updateHiddenFields(this.form)"
class="inputSmallMediumCombo"><option value=""></option> 
                                        <option value="01">January</option> 
                                        <option value="02">February</option> 
                                        <option value="03">March</option> 
                                        <option value="04">April</option> 
                                        <option value="05">May</option> 
                                        <option value="06">June</option> 
                                        <option value="07">July</option> 
                                        <option value="08">August</option> 
                                        <option value="09">September</option> 
                                        <option value="10">October</option> 
                                        <option value="11">November</option> 
                                        <option value="12">December</option></select> <select
name="endDateYear" onchange="updateHiddenFields(this.form)"
class="inputSmallYearCombo"><option value=""></option> 
                                        <option value="2012">2012</option> 
<option value="2011">2011</option> 
<option value="2010">2010</option> 
<option value="2009">2009</option> 
<option value="2008">2008</option> 
<option value="2007">2007</option> 
<option value="2006">2006</option> 
<option value="2005">2005</option> 
<option value="2004">2004</option> 
<option value="2003">2003</option> 
<option value="2002">2002</option> 
<option value="2001">2001</option> 
<option value="2000">2000</option> 
<option value="1999">1999</option> 
<option value="1998">1998</option> 
<option value="1997">1997</option> 
<option value="1996">1996</option> 
<option value="1995">1995</option> 
<option value="1994">1994</option> 
<option value="1993">1993</option> 
<option value="1992">1992</option> 
<option value="1991">1991</option> 
<option value="1990">1990</option> 
<option value="1989">1989</option> 
<option value="1988">1988</option> 
<option value="1987">1987</option> 
<option value="1986">1986</option> 
<option value="1985">1985</option> 
<option value="1984">1984</option> 
<option value="1983">1983</option> 
<option value="1982">1982</option> 
<option value="1981">1981</option> 
<option value="1980">1980</option> 
<option value="1979">1979</option> 
<option value="1978">1978</option> 
<option value="1977">1977</option> 
<option value="1976">1976</option> 
<option value="1975">1975</option> 
<option value="1974">1974</option> 
<option value="1973">1973</option> 
<option value="1972">1972</option> 
<option value="1971">1971</option> 
<option value="1970">1970</option> 
<option value="1969">1969</option> 
<option value="1968">1968</option> 
<option value="1967">1967</option> 
<option value="1966">1966</option> 
<option value="1965">1965</option> 
<option value="1964">1964</option> 
<option value="1963">1963</option> 
<option value="1962">1962</option></select>(month/year)
Business Phone<input type="text" name="phone" maxlength="12" value=""
onfocus="setMask(this,'phone')" class="inputPhone">
  <input type="hidden" name="addressBean.formId" value="0"> 
<input type="hidden" name="addressBean.addressId" value=""> 
<input type="hidden" name="addressBean.licensedEntityId" value=""> 
<input type="hidden" name="addressBean.entityType" value="EMP"> 
<input type="hidden" name="addressBean.addressTypeCode" value="EMP"> 
          <colgroup> 
                <col width="13%" align="left" /> 
                <col width="20%" align="left" /> 
                <col width="13%" align="left" /> 
                <col width="20%" align="left" /> 
                <col width="13%" align="left" /> 
                <col width="20%" align="left" /> 
        </colgroup> 
                                                                                                                                                       
                                                  Employment Address
                                                Detail
                       
                         
                                  <DIV
                                        id='Employment Address'> 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
Address Line 1
                                                                       
                                                                                                  <input type="text" name="addressBean.address1"
maxlength="100" value="" class="inputAddressTextField"> 
                                                                       
Address Line 2                                                                                                   <input type="text" name="addressBean.address2"
maxlength="100" value="" class="inputAddressTextField"> 
                                                                       
Address Line 3                                                                                                   <input type="text" name="addressBean.address3"
maxlength="50" value="" class="inputAddressTextField"> 
                                                                       
City
                                                       
                                                                                  <input type="text" name="addressBean.city" maxlength="100"
value="" class="inputCity"> 
                                                       
Country
                                                       
                                                                                  <select name="addressBean.countryCode"
onchange="getDDOptions('/PCRMVERSIONPREVIEW', this,
'addressBean.stateCode')" class="inputMediumCombo"
id="countyId"><option value=""></option> 
                                                                                                <option value="AF">Afghanistan</option> 
<option value="AL">Albania</option> 
<option value="DZ">Algeria</option> 
<option value="AS">American Samoa</option> 
<option value="AD">Andorra</option> 
<option value="AO">Angola</option> 
<option value="AI">Anguilla</option> 
<option value="AQ">Antarctica</option> 
<option value="AG">Antigua And Barbuda</option> 
<option value="AR">Argentina</option> 
<option value="AM">Armenia</option> 
<option value="AW">Aruba</option> 
<option value="AU">Australia</option> 
<option value="AT">Austria</option> 
<option value="AZ">Azerbaijan</option> 
<option value="BS">Bahamas</option> 
<option value="BH">Bahrain</option> 
<option value="BD">Bangladesh</option> 
<option value="BB">Barbados</option> 
<option value="BY">Belarus</option> 
<option value="BE">Belgium</option> 
<option value="BZ">Belize</option> 
<option value="BJ">Benin</option> 
<option value="BM">Bermuda</option> 
<option value="BT">Bhutan</option> 
<option value="BO">Bolivia</option> 
<option value="BA">Bosnia and Herzegovina</option> 
<option value="BW">Botswana</option> 
<option value="BV">Bouvet Island</option> 
<option value="BR">Brazil</option> 
<option value="IO">British Indian Ocean Territory</option> 
<option value="BN">Brunei</option> 
<option value="BG">Bulgaria</option> 
<option value="BF">Burkina Faso</option> 
<option value="BI">Burundi</option> 
<option value="KH">Cambodia</option> 
<option value="CM">Cameroon</option> 
<option value="CA">Canada</option> 
<option value="CV">Cape Verde</option> 
<option value="KY">Cayman Islands</option> 
<option value="CF">Central African Republic</option> 
<option value="TD">Chad</option> 
<option value="CIV">Channel Isles</option> 
<option value="CL">Chile</option> 
<option value="CN">China</option> 
<option value="CX">Christmas Island</option> 
<option value="CC">Cocos Keeling Islands</option> 
<option value="CO">Colombia</option> 
<option value="KM">Comoros</option> 
<option value="CG">Congo</option> 
<option value="CD">Congo</option> 
<option value="CK">Cook Islands</option> 
<option value="CR">Costa Rica</option> 
<option value="CI">Cote DIvoire Ivory Coast</option> 
<option value="HR">Croatia Hrvatska</option> 
<option value="CU">Cuba</option> 
<option value="CY">Cyprus</option> 
<option value="CZ">Czech Republic</option> 
<option value="DK">Denmark</option> 
<option value="DJ">Djibouti</option> 
<option value="DM">Dominica</option> 
<option value="DO">Dominican Republic</option> 
<option value="TP">East Timor</option> 
<option value="EC">Ecuador</option> 
<option value="EG">Egypt</option> 
<option value="SV">El Salvador</option> 
<option value="GQ">Equatorial Guinea</option> 
<option value="ER">Eritrea</option> 
<option value="EE">Estonia</option> 
<option value="ET">Ethiopia</option> 
<option value="FK">Falkland Islands</option> 
<option value="FO">Faroe Islands</option> 
<option value="FJ">Fiji Islands</option> 
<option value="FI">Finland</option> 
<option value="FR">France</option> 
<option value="GF">French Guiana</option> 
<option value="PF">French Polynesia</option> 
<option value="TF">French Southern Territories</option> 
<option value="GA">Gabon</option> 
<option value="GM">Gambia</option> 
<option value="GE">Georgia</option> 
<option value="DE">Germany</option> 
<option value="GH">Ghana</option> 
<option value="GI">Gibraltar</option> 
<option value="GR">Greece</option> 
<option value="GL">Greenland</option> 
<option value="GD">Grenada</option> 
<option value="GP">Guadeloupe</option> 
<option value="GU">Guam</option> 
<option value="GT">Guatemala</option> 
<option value="GN">Guinea</option> 
<option value="GW">GuineaBissau</option> 
<option value="GY">Guyana</option> 
<option value="HT">Haiti</option> 
<option value="HM">Heard and McDonald Islands</option> 
<option value="HN">Honduras</option> 
<option value="HK">Hong Kong S.A.R.</option> 
<option value="HU">Hungary</option> 
<option value="IS">Iceland</option> 
<option value="IN">India</option> 
<option value="ID">Indonesia</option> 
<option value="IR">Iran</option> 
<option value="IQ">Iraq</option> 
<option value="IE">Ireland</option> 
<option value="IM">Isle of Man</option> 
<option value="IL">Israel</option> 
<option value="IT">Italy</option> 
<option value="JM">Jamaica</option> 
<option value="JP">Japan</option> 
<option value="JO">Jordan</option> 
<option value="KZ">Kazakhstan</option> 
<option value="KE">Kenya</option> 
<option value="KI">Kiribati</option> 
<option value="KW">Kuwait</option> 
<option value="KG">Kyrgyzstan</option> 
<option value="LA">Laos</option> 
<option value="LV">Latvia</option> 
<option value="LB">Lebanon</option> 
<option value="LS">Lesotho</option> 
<option value="LR">Liberia</option> 
<option value="LY">Libya</option> 
<option value="LI">Liechtenstein</option> 
<option value="LT">Lithuania</option> 
<option value="LU">Luxembourg</option> 
<option value="MO">Macau S.A.R.</option> 
<option value="MK">Macedonia</option> 
<option value="MG">Madagascar</option> 
<option value="MW">Malawi</option> 
<option value="MY">Malaysia</option> 
<option value="MV">Maldives</option> 
<option value="ML">Mali</option> 
<option value="MT">Malta</option> 
<option value="MH">Marshall Islands</option> 
<option value="MQ">Martinique</option> 
<option value="MR">Mauritania</option> 
<option value="MU">Mauritius</option> 
<option value="YT">Mayotte</option> 
<option value="MX">Mexico</option> 
<option value="FM">Micronesia</option> 
<option value="MD">Moldova</option> 
<option value="MC">Monaco</option> 
<option value="MN">Mongolia</option> 
<option value="MS">Montserrat</option> 
<option value="MA">Morocco</option> 
<option value="MZ">Mozambique</option> 
<option value="MM">Myanmar</option> 
<option value="NA">Namibia</option> 
<option value="NR">Nauru</option> 
<option value="NP">Nepal</option> 
<option value="NL">Netherlands</option> 
<option value="AN">Netherlands Antilles</option> 
<option value="NC">New Caledonia</option> 
<option value="NZ">New Zealand</option> 
<option value="NI">Nicaragua</option> 
<option value="NE">Niger</option> 
<option value="NG">Nigeria</option> 
<option value="NU">Niue</option> 
<option value="NF">Norfolk Island</option> 
<option value="KR">North Korea</option> 
<option value="MP">Northern Mariana Islands</option> 
<option value="NO">Norway</option> 
<option value="OM">Oman</option> 
<option value="PK">Pakistan</option> 
<option value="PW">Palau</option> 
<option value="PA">Panama</option> 
<option value="PG">Papua new Guinea</option> 
<option value="PY">Paraguay</option> 
<option value="PE">Peru</option> 
<option value="PH">Philippines</option> 
<option value="PN">Pitcairn Island</option> 
<option value="PL">Poland</option> 
<option value="PT">Portugal</option> 
<option value="PR">Puerto Rico</option> 
<option value="QA">Qatar</option> 
<option value="RE">Reunion</option> 
<option value="RO">Romania</option> 
<option value="RU">Russia</option> 
<option value="RW">Rwanda</option> 
<option value="SH">Saint Helena</option> 
<option value="KN">Saint Kitts And Nevis</option> 
<option value="LC">Saint Lucia</option> 
<option value="PM">Saint Pierre and Miquelon</option> 
<option value="VC">Saint Vincent And The Grenadines</option> 
<option value="WS">Samoa</option> 
<option value="SM">San Marino</option> 
<option value="ST">Sao Tome and Principe</option> 
<option value="SA">Saudi Arabia</option> 
<option value="SN">Senegal</option> 
<option value="SC">Seychelles</option> 
<option value="SL">Sierra Leone</option> 
<option value="SG">Singapore</option> 
<option value="VK">Slovakia</option> 
<option value="SK">Slovakia</option> 
<option value="SI">Slovenia</option> 
<option value="SB">Solomon Islands</option> 
<option value="SO">Somalia</option> 
<option value="ZA">South Africa</option> 
<option value="GS">South Georgia And The South Sandwich</option> 
<option value="KP">South Korea</option> 
<option value="ES">Spain</option> 
<option value="LK">Sri Lanka</option> 
<option value="SD">Sudan</option> 
<option value="SR">Suriname</option> 
<option value="SJ">Svalbard And Jan Mayen Islands</option> 
<option value="SZ">Swaziland</option> 
<option value="SE">Sweden</option> 
<option value="CH">Switzerland</option> 
<option value="SY">Syria</option> 
<option value="TW">Taiwan</option> 
<option value="TJ">Tajikistan</option> 
<option value="TZ">Tanzania</option> 
<option value="TH">Thailand</option> 
<option value="TG">Togo</option> 
<option value="TK">Tokelau</option> 
<option value="TO">Tonga</option> 
<option value="TT">Trinidad And Tobago</option> 
<option value="TN">Tunisia</option> 
<option value="TR">Turkey</option> 
<option value="TM">Turkmenistan</option> 
<option value="TC">Turks And Caicos Islands</option> 
<option value="TV">Tuvalu</option> 
<option value="UG">Uganda</option> 
<option value="UA">Ukraine</option> 
<option value="AE">United Arab Emirates</option> 
<option value="UK">United Kingdom</option> 
<option value="US" selected="selected">United States</option> 
<option value="UM">United States Minor Outlying Islands</option> 
<option value="UY">Uruguay</option> 
<option value="UZ">Uzbekistan</option> 
<option value="VU">Vanuatu</option> 
<option value="VA">Vatican City</option> 
<option value="VE">Venezuela</option> 
<option value="VN">Vietnam</option> 
<option value="VG">Virgin Islands British</option> 
<option value="VI">Virgin Islands US</option> 
<option value="WF">Wallis And Futuna Islands</option> 
<option value="ESH">Western Sahara</option> 
<option value="WSM">Western Samoa</option> 
<option value="YE">Yemen</option> 
<option value="YU">Yugoslavia</option> 
<option value="ZM">Zambia</option> 
<option value="ZW">Zimbabwe</option></select> 
                                                       
State/Province
                                                       
<select name="addressBean.stateCode"
onchange="selectResState(this)" class="inputMediumCombo"><option
value="" selected="selected"></option> 
                                                                        <option value="AL">Alabama</option> 
<option value="AK">Alaska</option> 
<option value="AS">American Samoa</option> 
<option value="AZ">Arizona</option> 
<option value="AR">Arkansas</option> 
<option value="CA">California</option> 
<option value="CO">Colorado</option> 
<option value="CT">Connecticut</option> 
<option value="DE">Delaware</option> 
<option value="DC">District Of Columbia</option> 
<option value="FM">Federated States Of Micronesia</option> 
<option value="FL">Florida</option> 
<option value="GA">Georgia</option> 
<option value="GU">Guam</option> 
<option value="HI">Hawaii</option> 
<option value="ID">Idaho</option> 
<option value="IL">Illinois</option> 
<option value="IN">Indiana</option> 
<option value="IA">Iowa</option> 
<option value="KS">Kansas</option> 
<option value="KY">Kentucky</option> 
<option value="LA">Louisiana</option> 
<option value="ME">Maine</option> 
<option value="MH">Marshall Islands</option> 
<option value="MD">Maryland</option> 
<option value="MA">Massachusetts</option> 
<option value="MI">Michigan</option> 
<option value="MN">Minnesota</option> 
<option value="MS">Mississippi</option> 
<option value="MO">Missouri</option> 
<option value="MT">Montana</option> 
<option value="NE">Nebraska</option> 
<option value="NV">Nevada</option> 
<option value="NH">New Hampshire</option> 
<option value="NJ">New Jersey</option> 
<option value="NM">New Mexico</option> 
<option value="NY">New York</option> 
<option value="NC">North Carolina</option> 
<option value="ND">North Dakota</option> 
<option value="MP">Norther Marianas Islands</option> 
<option value="OH">Ohio</option> 
<option value="OK">Oklahoma</option> 
<option value="OR">Oregon</option> 
<option value="PW">Palau</option> 
<option value="PA">Pennsylvania</option> 
<option value="PR">Puerto Rico</option> 
<option value="RI">Rhode Island</option> 
<option value="SC">South Carolina</option> 
<option value="SD">South Dakota</option> 
<option value="TN">Tennessee</option> 
<option value="TX">Texas</option> 
<option value="UT">Utah</option> 
<option value="VT">Vermont</option> 
<option value="VI">Virgin Islands</option> 
<option value="VA">Virginia</option> 
<option value="WA">Washington</option> 
<option value="WV">West Virginia</option> 
<option value="WI">Wisconsin</option> 
<option value="WY">Wyoming</option></select> 
                                                       
County
                                                       
                                                                                  <input type="text" name="addressBean.county" maxlength="50"
value="" class="inputZip"> 
                                                       
Zip
                                                       
                                                                                  <input type="text" name="addressBean.zip" maxlength="15"
value="" onblur="validateZipFormat(this,'addressBean.countryCode')"
class="inputZip"> 
                                                       
                                  </DIV>
                                                                                 
<input type="button"
name="submit" value="OK" onclick="submitPopup(this, 'employmentGrid')"
class="MediumButton"> <input type="button" name="submit"
value="Cancel" onclick="closePopupWindow()" class="MediumButton">
  </form> 
<script> var curr_year =''+2012+''; var curr_month =''+05+''; function compareTwoDates(startDate, endDate, message) { var fromDate = startDate.value; var toDate = endDate.value; if( (toDate != "" && toDate.length > 0) && (fromDate == "" || fromDate.length == 0) ){ alert("From Date field cannot be blank"); return false; } if( (fromDate!= "" && fromDate.length > 0) && ((toDate == "" || toDate.length == 0) && document.forms[0].currentEmployer.checked == false) ){ alert("To Date field cannot be blank"); return false; } if( document.forms[0].currentEmployer.checked && (fromDate == "" || fromDate.length == 0) ){ alert("From Date field cannot be blank"); return false; } startDateV = Date.parse(fromDate); endDateV = Date.parse(toDate); diff = (startDateV - endDateV)/(24*60*60*1000); if (diff > 0) { alert(message); return false; } return true; } function updateHiddenFields(frm) { var startDateYear = frm.elements["startDateYear"].value; var endDateYear = frm.elements["endDateYear"].value; var startDateMonth = frm.elements["startDateMonth"].value; var endDateMonth = frm.elements["endDateMonth"].value; if(startDateYear > 0 && startDateMonth > 0) frm.elements["startDate"].value=startDateMonth+"/01/"+startDateYear; else frm.elements["startDate"].value=""; if(endDateYear > 0 && endDateMonth > 0) frm.elements["endDate"].value=endDateMonth+"/01/"+endDateYear; else frm.elements["endDate"].value=""; } function dateRangeValidation(field){ var strValue=field.value; for(var j=0; j < strValue.length; j++) { if (strValue.charCodeAt(j) < asciiNumberZero || strValue.charCodeAt(j)> asciiNumberNine) { result = setFocusOnObjectWithMessage("Only Numeric values from 1900 to "+curr_year+" are allowed.", field) return true; } } return false; } function validateYear(fld,fldName){ if(fld.value > curr_year || fld.value < 1900){ alert(fldName+" range should be between 1900 to "+curr_year+"."); fld.focus(); return true; } return false; } function dateValidation(frm){ var startDateMonth = frm.elements["startDateMonth"].value; var startDateYear = frm.elements["startDateYear"].value; if(startDateMonth.length < 1 && startDateYear.length > 0) { alert("Please select the From month"); frm.elements["startDateMonth"].focus(); return true; } if(startDateYear.length < 1 && startDateMonth.length > 0) { alert("Please provide the From Year"); frm.elements["startDateYear"].focus(); return true; } var endDateMonth = frm.elements["endDateMonth"].value; var endDateYear = frm.elements["endDateYear"].value; if( frm.currentEmployer.checked==false) { if(endDateMonth.length < 1 && endDateYear.length > 0) { alert("Please select the End month"); frm.elements["endDateMonth"].focus(); return true; } if(endDateYear.length < 1 && endDateMonth.length > 0) { alert("Please provide the End Year"); frm.elements["endDateYear"].focus(); return true; } } if(startDateYear.length > 0 && (dateRangeValidation(frm.elements["startDateYear"]) || validateYear(frm.elements["startDateYear"],"Start Date"))) { return true; } if( frm.currentEmployer.checked==false) { if(endDateYear.length > 0 && (dateRangeValidation(frm.elements["endDateYear"]) || validateYear(frm.elements["endDateYear"],"End Date"))) { return true; } } if((frm.currentEmployer.checked==true) && (frm.elements["startDate"].value == null || frm.elements["startDate"].value.lengh == 0) ){ alert("From Date field cannot be blank"); return true; } if(startDateYear==curr_year && parseInt(startDateMonth, 10)>curr_month) { alert("From Date should not be greater than Today's Date"); return true; } if(endDateYear==curr_year && parseInt(endDateMonth,10)>curr_month) { alert("To Date should not be greater than Today's Date"); return true; } return false; } function preSubmitPopupForm(frm) { var parentWindow = window.dialogArguments.opener; var mandFields = parentWindow.document.forms[0].elements["mandFields"]; var mandFieldMsg = parentWindow.document.forms[0].elements["mandFieldMsg"]; var msgKeyValue = new Array(); if(mandFieldMsg){ var splitArray = mandFieldMsg.value.split(","); for(var i=0;i<splitArray.length;i++){ var splitPipeArray = splitArray[i].split("|"); msgKeyValue[trim(splitPipeArray[0])] = splitPipeArray[1]; } } if(dateValidation(frm)){ return false; } var appliedEmployment = frm.elements["appliedEmployment"].value; var appliedEmpProfile = frm.elements["appliedEmpProfile"].value; if(appliedEmpProfile=='true'){ appliedEmployment = appliedEmpProfile; } var countryCode; if(frm.elements["addressBean.countryCode"]){ countryCode = frm.elements["addressBean.countryCode"].value; } if(frm.elements["countryCode"]){ countryCode = frm.elements["countryCode"].value; } if(appliedEmployment=='true'){ if(frm.elements["addressBean.countryCode"]){ if(countryCode != 'US' && validateFormMandatory(frm, new Array("employerName","positionHeld","startDateMonth","startDateYear"), new Array("Please provide an Employer name","Please provide position held","Please provide From Month","Please provide From Year")) && ! dateValidation(frm)) { if( frm.currentEmployer.checked==false) { if(validateFormMandatory(frm, new Array("endDateMonth","endDateYear"), new Array("Please provide To Month","Please provide To Year")) && !dateValidation(frm)){ if(!compareDateFields(frm, new Array("startDate"), new Array("endDate"), new Array("To Date must be greater than the From Date"))) return false; } else return false } return validateFormMandatory(frm, new Array("addressBean.city","addressBean.countryCode"), new Array("Please provide city name","Please provide country name")) } if(countryCode == 'US' && validateFormMandatory(frm, new Array("employerName","positionHeld","startDateMonth","startDateYear"), new Array("Please provide an Employer name","Please provide position held","Please provide From Month","Please provide From Year")) && ! dateValidation(frm)) { if( frm.currentEmployer.checked==false) { if(validateFormMandatory(frm, new Array("endDateMonth","endDateYear"), new Array("Please provide To Month","Please provide To Year")) && !dateValidation(frm)){ if(!compareDateFields(frm, new Array("startDate"), new Array("endDate"), new Array("To Date must be greater than or equal to the From Date"))) return false; } else return false } var appliedEmpProfile = frm.elements["appliedEmpProfile"].value; if(appliedEmpProfile=='true'){ return true; } return validateFormMandatory(frm, new Array("addressBean.city","addressBean.stateCode","addressBean.countryCode", "addressBean.zipCode"), new Array("Please provide city name","Please provide state name","Please provide country name","Please provide zip code")) } return false; } if(frm.elements["countryCode"]){ if(countryCode != 'US' && validateFormMandatory(frm, new Array("employerName","positionHeld","startDateMonth","startDateYear"), new Array("Please provide an Employer name","Please provide position held","Please provide From Month","Please provide From Year")) && ! dateValidation(frm)) { if( frm.currentEmployer.checked==false){ if(validateFormMandatory(frm, new Array("endDateMonth","endDateYear"), new Array("Please provide To Month","Please provide To Year")) && !dateValidation(frm)){ if(!compareDateFields(frm, new Array("startDate"), new Array("endDate"), new Array("To Date must be greater than or equal to the From Date"))) return false; } else return false } return validateFormMandatory(frm, new Array("city","countryCode"), new Array("Please provide city name","Please provide country name")) } var empFieldArray = new Array(); var empFieldMsgArray = new Array(); if(mandFields){ if(mandFields.value.match("empName")){ empFieldArray.push('employerName'); if(msgKeyValue.empName.length>0){ empFieldMsgArray.push(msgKeyValue.empName); } } }else{ empFieldArray.push('employerName'); empFieldMsgArray.push("Please provide an Employer name."); } if(mandFields){ if(mandFields.value.match("empPositionHeld")) { empFieldArray.push('positionHeld'); if(msgKeyValue.empPositionHeld.length>0){ empFieldMsgArray.push(msgKeyValue.empPositionHeld); } } }else{ empFieldArray.push('positionHeld'); empFieldMsgArray.push("Please provide position held."); } if(mandFields){ if(mandFields.value.match("empFromMonth")){ empFieldArray.push('startDateMonth'); if(msgKeyValue.empFromMonth.length>0){ empFieldMsgArray.push(msgKeyValue.empFromMonth); } } }else{ empFieldArray.push('startDateMonth'); empFieldMsgArray.push("Please provide From Month."); } if(mandFields){ if(mandFields.value.match("empFromYear")){ empFieldArray.push('startDateYear'); if(msgKeyValue.empFromYear.length>0){ empFieldMsgArray.push(msgKeyValue.empFromYear); } } }else{ empFieldArray.push('startDateYear'); empFieldMsgArray.push("Please provide From Year."); } //var empFieldArray = new Array("employerName","positionHeld","startDateMonth","startDateYear"); //var empFieldMsgArray = new Array("Please provide an Employer name","Please provide position held","Please provide From Month","Please provide From Year"); if(countryCode == 'US' && validateFormMandatory(frm, empFieldArray, empFieldMsgArray) && !dateValidation(frm)) { if( frm.currentEmployer.checked==false){ var empFieldArray1 = new Array(); var empFieldMsgArray1 = new Array(); if(mandFields){ if(mandFields.value.match("empToYear")) { empFieldArray1.push('endDateYear'); if(msgKeyValue.empToYear.length>0){ empFieldMsgArray1.push(msgKeyValue.empToYear); } } }else{ empFieldArray1.push('endDateYear'); empFieldMsgArray1.push("Please provide To Year."); } if(mandFields){ if(mandFields.value.match("empToMonth")){ empFieldArray1.push('endToMonth'); if(msgKeyValue.empToMonth.length>0){ empFieldMsgArray1.push(msgKeyValue.empToMonth); } } }else{ empFieldArray1.push('endToMonth'); empFieldMsgArray1.push("Please provide To Month."); } if(validateFormMandatory(frm, empFieldArray1, empFieldMsgArray1) && !dateValidation(frm)){ if(!compareDateFields(frm, new Array("startDate"), new Array("endDate"), new Array("To Date must be greater than or equal to the From Date"))) return false; } else return false } var empFieldArray2 = new Array(); var empFieldMsgArray2 = new Array(); if(mandFields){ if(mandFields.value.match("empCity")){ empFieldArray2.push('city'); if(msgKeyValue.empCity.length>0){ empFieldMsgArray2.push(msgKeyValue.empCity); } } }else{ empFieldArray2.push('city'); empFieldMsgArray2.push("Please provide city name."); } if(mandFields){ if(mandFields.value.match("empState")){ empFieldArray2.push('stateCode'); if(msgKeyValue.empState.length>0){ empFieldMsgArray2.push(msgKeyValue.empState); } } }else{ empFieldArray2.push('stateCode'); empFieldMsgArray2.push("Please provide state name."); } if(mandFields){ if(mandFields.value.match("empCountry")){ empFieldArray2.push('countryCode'); if(msgKeyValue.empCountry.length>0){ empFieldMsgArray2.push(msgKeyValue.empCountry); } } }else{ empFieldArray2.push('countryCode'); empFieldMsgArray2.push("Please provide country name."); } empFieldArray2.push('zipCode'); empFieldMsgArray2.push("Please provide zip code"); return validateFormMandatory(frm, empFieldArray2, empFieldMsgArray2); } } } else { if(validateFormMandatory(frm, new Array("employerName"), new Array("Please provide an Employer name"))) { return compareDateFields(frm, new Array("startDate"), new Array("endDate"), new Array("To Date must be greater than or equal to the From Date")); } /*if(validateFormMandatory(frm, new Array("employerName"), new Array("Please provide an Employer name"))) { if( frm.currentEmployer.checked==false && appliedEmployment==true) { if(validateFormMandatory(frm, new Array("endDateMonth","endDateYear"), new Array("Please provide To Month","Please provide To Year")) && !dateValidation(frm)) { return compareDateFields(frm, new Array("startDate"), new Array("endDate"), new Array("To Date must be greater than or equal to the From Date")); } return false; } return true; }*/ } /*if(appliedEmployment=='true' && countryCode != 'US' && validateFormMandatory(frm, new Array("employerName","positionHeld","employmentAddress.city","employmentAdd ress.countryCode","startDateMonth","startDateYear","endDateMonth","endDateY ear"), new Array("Please provide an Employer name","Please provide position held","Please provide city name","Please provide country name","Please provide From Month","Please provide From Year","Please provide To Month","Please provide from To Year")) && !dateValidation(frm)){ return compareDateFields(frm, new Array("startDate"), new Array("endDate"), new Array("To Date must be greater than or equal to the From Date")); } else if(appliedEmployment=='true' && validateFormMandatory(frm, new Array("employerName","positionHeld","employmentAddress.city","employmentAdd ress.stateCode","employmentAddress.countryCode","startDateMonth","startDate Year","endDateMonth","endDateYear"), new Array("Please provide an Employer name","Please provide position held","Please provide city name","Please provide state name","Please provide country name","Please provide From Month","Please provide From Year","Please provide To Month","Please provide from To Year")) && ! dateValidation(frm)){ return compareDateFields(frm, new Array("startDate"), new Array("endDate"), new Array("To Date must be greater than or equal to the From Date")); } else if(appliedEmployment=='false' && validateFormMandatory(frm, new Array("employerName"), new Array("Please provide an Employer name"))){ return compareDateFields(frm, new Array("startDate"), new Array("endDate"), new Array("To Date must be greater than or equal to the From Date")); }*/ return false; } function validateEndDate(frm){ if(frm.currentEmployer.checked){ var appliedEmployment = frm.elements["appliedEmployment"].value; if(frm.elements["appliedEmpProfile"]){ var appliedEmpProfile = frm.elements["appliedEmpProfile"].value; if(appliedEmpProfile=='true'){ appliedEmployment = appliedEmpProfile; } } if(appliedEmployment=='true'){ document.getElementById("toDateYes").style.display = 'none'; document.getElementById("toDateNo").style.display = 'block'; } frm.elements["endDateMonth"].value=""; frm.elements["endDateYear"].value=""; frm.elements["endDate"].value=""; frm.elements["endDateMonth"].disabled = true; frm.elements["endDateYear"].disabled = true; frm.elements["currentEmployer"].value="true"; }else { var appliedEmployment = frm.elements["appliedEmployment"].value; if(frm.elements["appliedEmpProfile"]){ var appliedEmpProfile = frm.elements["appliedEmpProfile"].value; if(appliedEmpProfile=='true'){ appliedEmployment = appliedEmpProfile; } } if(appliedEmployment=='true'){ document.getElementById("toDateYes").style.display = 'block'; document.getElementById("toDateNo").style.display = 'none'; } frm.elements["endDateMonth"].disabled = false; frm.elements["endDateYear"].disabled = false; frm.elements["currentEmployer"].value="false"; } } validateEndDate(document.forms[0]); updateHiddenFields(document.forms[0]); --></script>  </DIV> 
</BODY> 
</HTML>