This topic is locked
[SOLVED]

 Custom fields in forms

11/17/2010 7:44:34 AM
PHPRunner General questions
A
automaticjack author

Hi,
In earlier versions of phprunner I've sending custom fields trought $_REQUEST and $_SESSION:
Custom form sends custom fields.

Before process event: $_SESSION["customfield"] = $_REQUEST["customfield"]

Before record added: Execute some query using $_SESSION["customfield"]

After record added: Same thing.
Now in Before Process event $_REQUEST is empty due ajax processing, is there some way to read custom fields on forms and send to before and after events?. Where can I read these custom fields?.
Sorry for my english <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=15758&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />

Sergey Kornilov admin 11/17/2010

I'll supply sample code tomorrow.

Sergey Kornilov admin 11/18/2010

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 use $_REQUEST["test"] to access custom field value.

A
automaticjack author 11/19/2010

Thank you Sergey, I'm very pleased with the product and support.