<<BACK    HOME    CNCPT    TTRL    JSsf.net/projects/validateformjs[ U | s | m | ? ]
   rqd dec eml int len mcr bss trm sifAll Concepts
   frm txt pwd txa rdo sl1 chk slmAll Object Types

validate_form.js
Tutorial  [6/8]: CIBC or not?

[<<  <  >  >>]     view the code

'Crash if bad config', abbreviated as 'cibc' (and handled by vf_cibVFCfg.cibVFCfg()), analyzes your vf-configuration, crashing with helpful information and diagnostics, when an error is detected. Cibc is critical in development, as you create your vf-configuration. In production, when you know your vf-config is perfect, you can sacrifice it in order to maximize speed and minimize client download (it can always be turned on via the vfpd-toolbar).

What is your favorite integer between 8 and 7?
[[   RESET     [ Load CIBC ]   DBG     ]]
Here is an example of what can happen when you don't use cibc, but should. The vf-configuration for this form is invalid. Specifically, iMinLength is greater than iMaxLength, meaning everything is considered invalid.



Activating CIBC

With the below value for the 'sb_cibcOnOff' parameter, for validate_form... ...then when VFP-Diagnostics are off, cibc is... ...and when VFP-Diagnostics are on, cibc is... When Recommended
...configVF() ...configVFPD() Downloaded Active Downloaded* Active*
CIBC_ON  CIBC_ON  true true true true During initial development, to protect you from carelessness.
CIBC_OFF CIBC_ON  false false true true When diagnosing a particularly difficult, although short-term, problem. This prevents you from having to click [Load CIBC] and then select 'CRSH' from its drop down each time the page reloads (as may happen when a crash occurs).
CIBC_ON  CIBC_OFF true true false* false*  
CIBC_OFF CIBC_OFF false false false* false* During production, once you're certain the form's vf-config is perfect.

TOP     The code [6/8]   (try it)     [<<  <  >  >>]

 .
 

<HTML><HEAD>
<SCRIPT LANGUAGE="JavaScript1.3" SRC="../../../js_uncompressed/validate_form.js" TYPE="text/javascript"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.3">
//<!---
   loadVF('../../../js_uncompressed/');
   configVF("CIBC_OFF", -1);
   configVFPD("ON", "CIBC_OFF", "ON_LNK",
      "NO_OFF_LNK", "RESET_LNK", "NO_SUCCESS_DDB", "CIBC_SCTN", "CIBC_CRSH_DDB",
      [2], undefined);

   function submitGoodValues(f_orm)  {

      f_orm.fav_int.sMsgRequired = "What's your favorite integer?";
         f_orm.fav_int.sMsgTxtInt = "Your favorite integer must be an *integer* between ~RANGE_MIN~ and ~RANGE_MAX~, inclusive.";
            f_orm.fav_int.iIntMin = 8;
            f_orm.fav_int.iIntMax = 7;


      var sErrors = getFormErrorMsgs(f_orm, '   - ');

      if(sErrors)  {
         alert('OOPS!\n\n' + sErrors);
         return false;
      }  else  {
         alert('HOORAY!\n\nForm "submitted" successfully.\n\n(To submit for real, comment out this alert line, and return true instead of false.)');
         return false;
      }
   }
//--->
</SCRIPT>
</HEAD><BODY onLoad="completeVFLoad();">


      <FORM NAME="form_fav_int" onSubmit="return submitGoodValues(this);" METHOD="post">
         What is your favorite integer between 8 and <B>7</B>?  <INPUT TYPE="text" NAME="fav_int" SIZE="10" VALUE="8">
         <BR><INPUT TYPE="submit" VALUE="Here you go">
   </FORM>
<SCRIPT LANGUAGE="JavaScript1.3">
//<!---
   wrtVFPDToolbar();
//--->
</SCRIPT>
</BODY></HTML>
































SourceForge.net Logo

Copyright (C) 2003-2005, Jeff Epstein.   All rights reserved.