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: