JavaScript Field Events

From All n One's bxp software Wixi

Jump to: navigation, search

In a form in bxp software (bxp), there are many questions that can be added. There are areas you enter data into. Text Boxes are single line boxes where you can type in data. Drop down lists allow you to select data. Each of these areas on the page are called "Input Types". In HTML they are created using an input or select element. These elements are very powerful.


When you type on a web page, the text will only go into one box at a time. You can only select options from one drop down list at a time. The term used is that whatever element you are interacting with "has focus". Having focus is usually signified by a blinking vertical line (the cursor). This is how you know when you type, where your text will appear.


JavaScript is the programming language on a webpage that allows you to alter things when an event happens.


Lets take a simple text box on the page. Nothing goes into the text box when you type. You click in the box and the blinking cursor appears. This has caused an event called onFocus. You click anywhere else on the page and this fires another event for that text box called onBlur. So into a box... onFocus. Come out of the box... onBlur.


When you type some extra characters in the box and then move the focus out of the box, another event occurs called onChange. So the sequence of events that can happen an input element are onFocus, onChange and onBlur in that order.


In BE you can add JavaScript instructions to any question to cause activity to happen when any of these events occur on any question. This is exceptionally useful for validation and optimising processes when certain data or items are entered. Just edit the question through Main Menu > Form Management > Form - Question Management > Question - Edit > Choose your Form > Choose your Question > Custom JavaScript > You will see the sections available. Alternately you can click the pencil icon to the right of the question you want to change, if you have edit permissions on the form you're working on.


Question JavaScriptOptions.png