This topic is locked

Retrieving content of a custom field on a form

10/31/2022 10:15:13 AM
ASPRunner.NET General questions
D
david powell author

Hi,

There is an example in ASPrunner guide as to how to insert a custom field on a form using

<INPUT id=test type=text> on the code view of styles template.

The guide then mentions putting code into the onload event but doesnt say what the code is. In PHP $REQUEST("test") apparently retrieves the content.

My goal is to get user input into two controls to create a date range, insert values into XSession variables and then use those to run a report, all via tripart event in a custom button on the same form.

Cany anyone point me towards some guidance or examples? I am sure what I am doing has been done loads of times before!

Many thanks
DAvid.

admin 10/31/2022

We'll fix the manual.

Here is the code you need to add to the Javascript OnLoad event:

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

And then in the event like BeforeAdd you can use postvalue("test") to access that field value.