Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Help Help Help urgent !!!

I have two frames in a document.

ie,

frame 1 has a save button.

frame 2 have a form and other objects to collect user registration.

so with above things,how can i validate for a mandatory field in frame2 when user clicks a save button in a frame 1?

note:

i have written a function in frame 2 for validating the field and i am calling it from frame1 onclick of save button.the problem here is i am able to get the alert message when field is null but the focus is not going there.so pls can any of give some valuable suggestions or pls give some links who have already used such things in their web sites.or pls give me a pieace of code.


Comments

  • An example:



    Please use a clear subject instead of "help help help please."



    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">;



    <HTML>

    <HEAD>

    <META http-equiv="pragma" CONTENT="no-cache">

    <META NAME="Keywords" CONTENT="Oefening 1, GroepT, Ralph Eyckerman, HTML, Altavista, Yahoo, search engines">

    <META NAME="Owner" CONTENT="Ralph Eyckerman">

    <META NAME="Version" CONTENT="1.02">



    <LINK HREF="../../GroepT.css" REL="Stylesheet" TYPE="text/css">



    <TITLE>Oefening 4 mailform</TITLE>



    <SCRIPT>



    /* Global variable for error flag. Will be used in the error function. */

    var errFound = false;



    /* Function to validate the length of a string. */

    function validLength(item, len) {

    /* Returns false if the length of the item is less than the specified len. */

    return (item.length >= len);

    }



    /* Function to validate an e-mail address. */

    function validEmail(item) {

    if (!validLength(item, 7)) return false;

    /* The method indexOf() searches for a string (@) in a string (item).

    Returns the position of the string if it is found (starting with 0 for the first character.

    Returns -1 if the string is not found... */

    if (item.indexOf('@', 0) == -1) return false;

    return true;

    }



    /* Function to display an error message. */

    function error(elem, text) {

    /* Exit if an error message has already been displayed. */

    if(errFound) return;

    window.alert(text);

    elem.select();

    elem.focus();

    errFound = true;

    }



    /* Main validation function */

    function validateForm() {

    errFound = false;

    if(!validLength(document.mailform.name.value,5))

    error(document.mailform.name, "Please provide your full name.");

    if(!validEmail(document.mailform.replyemail.value))

    error(document.mailform.replyemail, "Please provide a valid e-mail address.");

    if(!validLength(document.mailform.comments.value,20))

    error(document.mailform.comments, "Please provide a comment.");

    return !errFound;

    }



    </SCRIPT>



    </HEAD>



    <BODY BGCOLOR="#65A3ED">





    <FORM NAME="mailform" onSubmit="return validateForm();" ACTION="http://pub49.bravenet.com/emailfwd/senddata.asp"; METHOD="post">

    <INPUT TYPE="hidden" NAME="usernum" VALUE="4200755020">

    <INPUT TYPE="hidden" NAME="cpv" VALUE="1">



    <!-- Start of custom zone>

    <TABLE BORDER=0 ALIGN="center">

    <TR>

    <TD ALIGN="right"><DIV CLASS="MainText"><LABEL FOR="name"><U>F</U>ull name:</LABEL></DIV></TD>

    <TD><DIV CLASS="MainText"><INPUT TYPE="text" NAME="name" ID="name" ACCESSKEY="F" SIZE="47"></DIV></TD>

    </TR>

    <TR>

    <TD ALIGN="right"><DIV CLASS="MainText"><LABEL FOR="Loc"><U>L</U>ocation</LABEL></DIV></TD>

    <TD><DIV CLASS="MainText">

    <SELECT NAME="Location" ID="Loc" ACCESSKEY="L">

    <!-- Thank you AltaVista for this complete list... --!>

    <OPTION VALUE="US">United States

    <OPTION VALUE="AF">Afghanistan

    <OPTION VALUE="AL">Albania

    <OPTION VALUE="DZ">Algeria

    <OPTION VALUE="AS">American Samoa

    <OPTION VALUE="AD">Andorra

    <OPTION VALUE="AO">Angola

    <OPTION VALUE="AI">Anguilla

    <OPTION VALUE="AQ">Antarctica

    <OPTION VALUE="AG">Antigua And Barbuda

    <OPTION VALUE="AR">Argentina

    <OPTION VALUE="AM">Armenia

    <OPTION VALUE="AW">Aruba

    <OPTION VALUE="AU">Australia

    <OPTION VALUE="AT">Austria

    <OPTION VALUE="AZ">Azerbaijan

    <OPTION VALUE="BS">Bahamas

    <OPTION VALUE="BH">Bahrain

    <OPTION VALUE="BD">Bangladesh

    <OPTION VALUE="BB">Barbados

    <OPTION VALUE="BY">Belarus

    <OPTION VALUE="BE" SELECTED >Belgium

    <OPTION VALUE="BZ">Belize

    <OPTION VALUE="BJ">Benin

    <OPTION VALUE="BM">Bermuda

    <OPTION VALUE="BT">Bhutan

    <OPTION VALUE="BO">Bolivia

    <OPTION VALUE="BA">Bosnia and Herzegovina

    <OPTION VALUE="BW">Botswana

    <OPTION VALUE="BV">Bouvet Island

    <OPTION VALUE="BR">Brazil

    <OPTION VALUE="IO">British Indian Ocean Territory

    <OPTION VALUE="BN">Brunei

    <OPTION VALUE="BG">Bulgaria

    <OPTION VALUE="BF">Burkina Faso

    <OPTION VALUE="BI">Burundi

    <OPTION VALUE="KH">Cambodia

    <OPTION VALUE="CM">Cameroon

    <OPTION VALUE="CA">Canada

    <OPTION VALUE="CV">Cape Verde

    <OPTION VALUE="KY">Cayman Islands

    <OPTION VALUE="CF">Central African Republic

    <OPTION VALUE="TD">Chad

    <OPTION VALUE="CL">Chile

    <OPTION VALUE="CN">China

    <OPTION VALUE="CX">Christmas Island

    <OPTION VALUE="CC">Cocos (Keeling) Islands

    <OPTION VALUE="CO">Columbia

    <OPTION VALUE="KM">Comoros

    <OPTION VALUE="CG">Congo

    <OPTION VALUE="CK">Cook Islands

    <OPTION VALUE="CR">Costa Rica

    <OPTION VALUE="CI">Cote D'Ivoire (Ivory Coast)

    <OPTION VALUE="HR">Croatia (Hrvatska)

    <OPTION VALUE="CU">Cuba

    <OPTION VALUE="CY">Cyprus

    <OPTION VALUE="CZ">Czech Republic

    <OPTION VALUE="KP">D.P.R. Korea

    <OPTION VALUE="CD">Dem Rep of Congo (Zaire)

    <OPTION VALUE="DK">Denmark

    <OPTION VALUE="DJ">Djibouti

    <OPTION VALUE="DM">Dominica

    <OPTION VALUE="DO">Dominican Republic

    <OPTION VALUE="TP">East Timor

    <OPTION VALUE="EC">Ecuador

    <OPTION VALUE="EG">Egypt

    <OPTION VALUE="SV">El Salvador

    <OPTION VALUE="GQ">Equatorial Guinea

    <OPTION VALUE="ER">Eritrea

    <OPTION VALUE="EE">Estonia

    <OPTION VALUE="ET">Ethiopia

    <OPTION VALUE="FK">Falkland Islands (Malvinas)

    <OPTION VALUE="FO">Faroe Islands

    <OPTION VALUE="FJ">Fiji

    <OPTION VALUE="FI">Finland

    <OPTION VALUE="FR">France

    <OPTION VALUE="GF">French Guiana

    <OPTION VALUE="PF">French Polynesia

    <OPTION VALUE="TF">French Southern Territories

    <OPTION VALUE="GA">Gabon

    <OPTION VALUE="GM">Gambia

    <OPTION VALUE="GE">Georgia

    <OPTION VALUE="DE">Germany

    <OPTION VALUE="GH">Ghana

    <OPTION VALUE="GI">Gibraltar

    <OPTION VALUE="GR">Greece

    <OPTION VALUE="GL">Greenland

    <OPTION VALUE="GD">Grenada

    <OPTION VALUE="GP">Guadeloupe

    <OPTION VALUE="GU">Guam

    <OPTION VALUE="GT">Guatemala

    <OPTION VALUE="GN">Guinea

    <OPTION VALUE="GW">Guinea-Bissau

    <OPTION VALUE="GY">Guyana

    <OPTION VALUE="HT">Haiti

    <OPTION VALUE="HM">Heard and McDonald Islands

    <OPTION VALUE="HN">Honduras

    <OPTION VALUE="HK">Hong Kong SAR, PRC

    <OPTION VALUE="HU">Hungary

    <OPTION VALUE="IS">Iceland

    <OPTION VALUE="IN">India

    <OPTION VALUE="ID">Indonesia

    <OPTION VALUE="IR">Iran

    <OPTION VALUE="IQ">Iraq

    <OPTION VALUE="IE">Ireland

    <OPTION VALUE="IL">Israel

    <OPTION VALUE="IT">Italy

    <OPTION VALUE="JM">Jamaica

    <OPTION VALUE="JP">Japan

    <OPTION VALUE="JO">Jordan

    <OPTION VALUE="KZ">Kazakhstan

    <OPTION VALUE="KE">Kenya

    <OPTION VALUE="KI">Kiribati

    <OPTION VALUE="KR">Korea

    <OPTION VALUE="KW">Kuwait

    <OPTION VALUE="KG">Kyrgyzstan

    <OPTION VALUE="LA">Lao

    <OPTION VALUE="LV">Latvia

    <OPTION VALUE="LB">Lebanon

    <OPTION VALUE="LS">Lesotho

    <OPTION VALUE="LR">Liberia

    <OPTION VALUE="LY">Libya

    <OPTION VALUE="LI">Liechtenstein

    <OPTION VALUE="LT">Lithuania

    <OPTION VALUE="LU">Luxembourg

    <OPTION VALUE="MO">Macao

    <OPTION VALUE="MK">Macedonia

    <OPTION VALUE="MG">Madagascar

    <OPTION VALUE="MW">Malawi

    <OPTION VALUE="MY">Malaysia

    <OPTION VALUE="MV">Maldives

    <OPTION VALUE="ML">Mali

    <OPTION VALUE="MT">Malta

    <OPTION VALUE="MH">Marshall Islands

    <OPTION VALUE="MQ">Martinique

    <OPTION VALUE="MR">Mauritania

    <OPTION VALUE="MU">Mauritius

    <OPTION VALUE="YT">Mayotte

    <OPTION VALUE="MX">Mexico

    <OPTION VALUE="FM">Micronesia

    <OPTION VALUE="MD">Moldova

    <OPTION VALUE="MC">Monaco

    <OPTION VALUE="MN">Mongolia

    <OPTION VALUE="MS">Montserrat

    <OPTION VALUE="MA">Morocco

    <OPTION VALUE="MZ">Mozambique

    <OPTION VALUE="MM">Myanmar

    <OPTION VALUE="NA">Namibia

    <OPTION VALUE="NR">Nauru

    <OPTION VALUE="NP">Nepal

    <OPTION VALUE="NL">Netherlands

    <OPTION VALUE="AN">Netherlands Antilles

    <OPTION VALUE="NC">New Caledonia

    <OPTION VALUE="NZ">New Zealand

    <OPTION VALUE="NI">Nicaragua

    <OPTION VALUE="NE">Niger

    <OPTION VALUE="NG">Nigeria

    <OPTION VALUE="NU">Niue

    <OPTION VALUE="NF">Norfolk Island

    <OPTION VALUE="MP">Northern Mariana Islands

    <OPTION VALUE="NO">Norway

    <OPTION VALUE="OM">Oman

    <OPTION VALUE="PK">Pakistan

    <OPTION VALUE="PW">Palau

    <OPTION VALUE="PA">Panama

    <OPTION VALUE="PG">Papua new Guinea

    <OPTION VALUE="PY">Paraguay

    <OPTION VALUE="PE">Peru

    <OPTION VALUE="PH">Philippines

    <OPTION VALUE="PN">Pitcairn

    <OPTION VALUE="PL">Poland

    <OPTION VALUE="PT">Portugal

    <OPTION VALUE="PR">Puerto Rico

    <OPTION VALUE="QA">Qatar

    <OPTION VALUE="RE">Reunion

    <OPTION VALUE="RO">Romania

    <OPTION VALUE="RU">Russia

    <OPTION VALUE="RW">Rwanda

    <OPTION VALUE="KN">Saint Kitts And Nevis

    <OPTION VALUE="LC">Saint Lucia

    <OPTION VALUE="VC">Saint Vincent And The Grenadines

    <OPTION VALUE="WS">Samoa

    <OPTION VALUE="SM">San Marino

    <OPTION VALUE="ST">Sao Tome and Principe

    <OPTION VALUE="SA">Saudi Arabia

    <OPTION VALUE="SN">Senegal

    <OPTION VALUE="SC">Seychelles

    <OPTION VALUE="SL">Sierra Leone

    <OPTION VALUE="SG">Singapore

    <OPTION VALUE="SK">Slovak Republic

    <OPTION VALUE="SI">Slovenia

    <OPTION VALUE="SB">Solomon Islands

    <OPTION VALUE="SO">Somalia

    <OPTION VALUE="ZA">South Africa

    <OPTION VALUE="GS">South Georgia And The South Sandwich Islands

    <OPTION VALUE="ES">Spain

    <OPTION VALUE="LK">Sri Lanka

    <OPTION VALUE="SH">St Helena

    <OPTION VALUE="PM">St Pierre and Miquelon

    <OPTION VALUE="SD">Sudan

    <OPTION VALUE="SR">Suriname

    <OPTION VALUE="SJ">Svalbard And Jan Mayen Islands

    <OPTION VALUE="SZ">Swaziland

    <OPTION VALUE="SE">Sweden

    <OPTION VALUE="CH">Switzerland

    <OPTION VALUE="SY">Syria

    <OPTION VALUE="TW">Taiwan Region

    <OPTION VALUE="TJ">Tajikistan

    <OPTION VALUE="TZ">Tanzania

    <OPTION VALUE="TH">Thailand

    <OPTION VALUE="TG">Togo

    <OPTION VALUE="TK">Tokelau

    <OPTION VALUE="TO">Tonga

    <OPTION VALUE="TT">Trinidad And Tobago

    <OPTION VALUE="TN">Tunisia

    <OPTION VALUE="TR">Turkey

    <OPTION VALUE="TM">Turkmenistan

    <OPTION VALUE="TC">Turks And Caicos Islands

    <OPTION VALUE="TV">Tuvalu

    <OPTION VALUE="UG">Uganda

    <OPTION VALUE="UA">Ukraine

    <OPTION VALUE="AE">United Arab Emirates

    <OPTION VALUE="UK">United Kingdom

    <OPTION VALUE="UM">United States Minor Outlying Islands

    <OPTION VALUE="UY">Uruguay

    <OPTION VALUE="UZ">Uzbekistan

    <OPTION VALUE="VU">Vanuatu

    <OPTION VALUE="VA">Vatican City State (Holy See)

    <OPTION VALUE="VE">Venezuela

    <OPTION VALUE="VN">Vietnam

    <OPTION VALUE="VG">Virgin Islands (British)

    <OPTION VALUE="VI">Virgin Islands (US)

    <OPTION VALUE="WF">Wallis And Futuna Islands

    <OPTION VALUE="EH">Western Sahara

    <OPTION VALUE="YE">Yemen

    <OPTION VALUE="YU">Yugoslavia

    <OPTION VALUE="ZM">Zambia

    <OPTION VALUE="ZW">Zimbabwe

    </DIV></TD>

    </TR>

    <TR>

    <TD ALIGN="right"><DIV CLASS="MainText"><LABEL FOR="email"><U>E</U>-mail address:</LABEL></DIV></TD>

    <TD><DIV CLASS="MainText"><INPUT TYPE="text" NAME="replyemail" ID="email" ACCESSKEY="E" SIZE="47"></DIV></TD>

    </TR>

    <TR>

    <TD ALIGN="right"><DIV CLASS="MainText">Do you like this site?</LABEL></DIV></TD>

    <TD><DIV CLASS="MainText">

    <LABEL FOR="Yes"><U>Y</U>es</LABEL>&nbsp;<INPUT TYPE="radio" NAME="LikeThisSite" ID="Yes" ACCESSKEY="Y" CHECKED VALUE="yes">&nbsp;&nbsp;&nbsp;

    <LABEL FOR="No"><U>N</U>o</LABEL>&nbsp;<INPUT TYPE="radio" NAME="LikeThisSite" ID="No" ACCESSKEY="N" VALUE="no"></DIV></TD>

    </TR>

    <TR>

    <TD ALIGN="right"><DIV CLASS="MainText"><LABEL FOR="comm"><U>C</U>omments please:</LABEL></DIV></TD>

    <TD><DIV CLASS="MainText"><TEXTAREA WRAP="virtual" NAME="comments" ID="comm" ACCESSKEY="C" COLS="43" ROWS="5"></TEXTAREA></DIV></TD>

    </TR>

    <TR>

    <TD COLSPAN="2" ALIGN="center"><DIV CLASS="MainText">

    <INPUT TYPE="submit" NAME="submit" VALUE=" Send ">&nbsp;

    <INPUT TYPE="reset" NAME="reset" VALUE=" Clear "></DIV></TD>

    </TR>

    </TABLE>

    <BR>

    <DIV CLASS="MainText" ALIGN="center">

    <HR>

    <BR>



    <!-- End of custom zone>

    <A HREF="http://www.bravenet.com/"><IMG SRC="Images/formbutt.gif" ALT="Bravenet home" BORDER="0" WIDTH="100" HEIGHT="35"></A>

    </DIV>

    </FORM>



    </BODY>



    </HTML>






Sign In or Register to comment.