www.webdeveloper.com
Results 1 to 3 of 3

Thread: Check form with warning

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    3

    Check form with warning

    Hello there webspecialists,

    After searching and testing several hours without having succes I've to do it another way.

    I'm looking for a formcheck, which can check and give a warning if there is a field missing, but can save the form even when user saves the form include the missing field.

    Sounds strange, but it is a check for a 95% obligated field, but still has the possibility to save form while user knows he is missing a field.

    See it as a warning, so like ' are you sure you don't want to fill in your prefences ' ?
    If user clicks Yes, then save the form incl. the missing field.
    If user clicks No, back to the form so he can fill in the missing field.

    It's that possible? And where to find such a script ?

    Many thanks in advance !

    Ysabel

  2. #2
    Join Date
    Jun 2004
    Location
    Portsmouth UK
    Posts
    2,689
    Code:
    <!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" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <style type="text/css">
    /*<![CDATA[*/
    
    .mask {
      position:fixed;left:0px;top:200px;width:100%;height:500px;
    }
    
    #popup {
      position:absolute;visibility:hidden;left:120px;top:0px;width:300px;height:100px;background-Color:#FFFF66;padding-Top:10px;text-Align:center;border:solid red 1px;
    }
    
    #popup DIV{
      left:0px;top:0px;width:300px;height:40px;margin-Top:5px;
    }
    
    /*]]>*/
    </style>
    
    
    <script type="text/javascript">
    
    function Check(frm){
     var ip=frm.tom,pop=document.getElementById('popup');
     if (ip.value==''){
      pop.style.left=(pop.parentNode.offsetWidth-pop.offsetWidth)/2+'px';
      pop.getElementsByTagName('DIV')[0].innerHTML='tom has not been completed';
      pop.style.visibility='visible';
      return false;
     }
     return true;
    }
    
    </script>
    
    </head>
    
    <body>
    
    <form onsubmit="return Check(this);" action="http://www.vicsjavascripts.org.uk/" >
    <input name="tom" />
    <br />
    <input type="submit" name="" value="Submit" />
    </form>
    
    
    <div class="mask" >
     <div id="popup" >
      <div >Message</div>
      Do you wish to proceed?<br />
      <input type="checkbox" name="" onmouseup="document.forms[0].submit();" /> Yes || No <input type="checkbox" name=""  onmouseup="document.getElementById('popup').style.visibility='hidden'"/>
     </div>
    </div>
    </body>
    
    </html>
    Vic

    God loves you and will never love you less.

    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  3. #3
    Join Date
    Feb 2013
    Posts
    3
    Great vwphillips,

    Exactly what I needed !
    Many thanks !

    Rgds,
    Ysabel

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles