Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Add CorrectCase to the CSS Class property of the control to enable this JavaScript.  

Limit selection of checkbox options

The JavaScript below will limit the choices to a maximum of three for a checkbox control in a form. Add limit3 to the CSS Class property of that control to enable this JavaScript.  

Code Block
var CustomEventHandlers = {
   setup: function (el) {
       if (CustomView.hasClass(el, 'limit3')) {
           FEvent.observe(el, 'click', this.checkboxlimit.bindAsObserver(this, el));
       }
   },
   checkboxlimit: function (evt, el) {
       var checkgroup = el.childrenWithClassName('input');
       var limit = 3;
       for (var i = 0; i < checkgroup.length; i++) {
           checkgroup[i].onclick = function () {
               var checkedcount = 0
               for (var i = 0; i < checkgroup.length; i++)
               checkedcount += (checkgroup[i].checked) ? 1 : 0
               if (checkedcount > limit) {
                   this.checked = false
                   for (var i = 0; i < checkgroup.length; i++)
                   (checkgroup[i].checked) ? checkgroup[i].disabled = false : checkgroup[i].disabled = true;
               } else {
                   for (var i = 0; i < checkgroup.length; i++)
                   checkgroup[i].disabled = false;
               }
           }
       }
   }
}

 

Scroll to Top

A Tab control with many fields in each tab, may require a long scroll to switch from one tab to another. You can use a trigger control at the bottom of the first tab with a business rule to navigate the user to the second tab when the trigger is clicked. For example, when you click on the Next Tab trigger control on the Personal Information tab in the Application for Employment form shown a business rule will navigate the user to the Employment History tab. 

...

Tip

 Users expect the submit and cancel buttons to be located at the bottom of a form. Moving the location of the Submit control is not recommended.

 

Submit on Enter Key Press

This JavaScript example will submit the form upon when the user pressing presses the Enter key.

Code Block
if (document.layers) {
   document.captureEvents(Event.KEYPRESS);
}

document.onkeypress = function (evt) {
   var keyCode = evt ? evt.which : event.keyCode;
   if (keyCode == 13) {
      SubmitView.doSubmit("Submit");
   } else { 
      return true;
   }
};

...