This topic is locked

How to add a custom field to the form

11/18/2010 11:00:01 PM
PHPRunner Tips and Tricks
Sergey Kornilov admin

Here is how you can do this:

  1. Add a custom input field to your form

<INPUT id=test type=text>


Make sure you specify field ID.
2. Add the following code to 'Javascript OnLoad' event of the page where custom field was added

this.on('beforeSave', function(formObj, fieldControlsArr, pageObj){

var val = $("#test").val();

formObj.baseParams['test1'] = val;

});


3. In any event like BeforeRecordAdded or BeforeProcess use $_REQUEST["test"] to access custom field value.

T
text 12/17/2010

Hi Sergey/Ann
I've tried to do use the code below inserting a text area into an edit page (calling it test) and then copying and pasting exactly what you have written below into the Javascript OnLoad event of the edit page and cannot get it to work. I've tried to just print the data entered into the field just to see if the value can be requested but it doesn't seem to work.
I know nothing about java so am unable to work out if there is an error in the code below.
I'm using the latest build of 5.3
Thanks
Richard



Here is how you can do this:

  1. Add a custom input field to your form

<INPUT id=test type=text>


Make sure you specify field ID.
2. Add the following code to 'Javascript OnLoad' event of the page where custom field was added

this.on('beforeSave', function(formObj, fieldControlsArr, pageObj){

var val = $("#test").val();

formObj.baseParams['test1'] = val;

});


3. In any event like BeforeRecordAdded or BeforeProcess use $_REQUEST["test"] to access custom field value.

Sergey Kornilov admin 12/17/2010

Richard,
hard to tell what might be wrong without seeing your files.
I recommend to post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.

E
eventplugin 2/1/2011

I'm having similar problems not getting it to work. Only I changed references to test to quantity (which makes more sense in my application) but left rest of the code unchanged. Please do let me know what was the solution. Thanks, Vivek



Hi Sergey/Ann
I've tried to do use the code below inserting a text area into an edit page (calling it test) and then copying and pasting exactly what you have written below into the Javascript OnLoad event of the edit page and cannot get it to work. I've tried to just print the data entered into the field just to see if the value can be requested but it doesn't seem to work.
I know nothing about java so am unable to work out if there is an error in the code below.
I'm using the latest build of 5.3
Thanks
Richard

E
eventplugin 2/1/2011

Figured out what was wrong. I removed the number "1" in the line formObj.baseParams['test1'] and it worked after that.



I'm having similar problems not getting it to work. Only I changed references to test to quantity (which makes more sense in my application) but left rest of the code unchanged. Please do let me know what was the solution. Thanks, Vivek