Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Sample events > Appearance

Add a custom field to the form

Scroll Prev Next More

 

To add a custom field to the form, follow the instructions below. This technique applies to Add, Edit and Login pages.

 

 

1. Proceed to the Page Designer page, insert Code Snippet there that outputs HTML code of the input filed. Make sure you specify the field ID as it will be required later in Javascript.

 

echo "<INPUT id='newfield' type='text'>";

 

 

2. Add the following code to the JavaScript OnLoad event of the page where the custom field was added:

 

this.on('beforeSave', function(formObj, fieldControlsArr, pageObj){
  var val = $("#newfield").val();
  formObj.baseParams['newfield'] = val;
});

 

3. In any event like Before record added or Before process use postvalue("newfield") to access the custom field value.

See also:

ctrl.on

Control object

JavaScript API

About Editor

Event editor

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software