cancel
Showing results for 
Search instead for 
Did you mean: 

Using REQUEST->GET_FORM_DATA for two separate events

Former Member
0 Kudos

Hi All,

Imagine the following scenario:

A BSP form is loaded with pre-populated form elements (i.e. some of the text fields are pre-populated from back-end using onInitialization event).

A user changes the content of HTML form (i.e. enters some new values in text fields) and hits the save button. onInputProcessing event is triggered.

What I am trying to accomplish is to get two sets of data using REQUEST->GET_FORM_DATA method.

1) When the form loads (but before user has a chance to change form content).

2) When the form is submitted with new values.

The reason is that I want to compare each data set (initial and modified) to create a "log" of what fields have been changed.

Did anyone ever face a similar task? Thanks in advance for all help.

Regards,

Roman D.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member181879
Active Contributor
0 Kudos

Hallo Roman,

There is one idea, which I have seen CRM colleagues do. But this is for browser. You should do some reading up of the "defaultValue" attribute on input fields from some website on HTML dom. What this script does is find all input fields, and see which value is not the way it was before.


function htmlbSubmitPre(){
 var formID=document.getElementById("myFormId"); 
 var allInp=formID.getElementsByTagName('INPUT');	
 for(var i=0;i<allInp.length;i++){
  if(allInp<i>.type=='text' {
   if(allInp<i>.value==allInp<i>.defaultValue){
     ...
   }
  } 
 }
}

athavanraja
Active Contributor
0 Kudos

In the oninitialization event move the current values to some hidden form field and in oninputprocessing read the hidden field values and the user entered values from the input fields using REQUEST->GET_FORM_DATA .

Regards

Raja

maximilian_schaufler
Active Contributor
0 Kudos

There is no standard way to get "old" and "new" values, as there is always only the "new" value submitted by the form.

Placing the "old" values into hidden form fields sure works, but is just creating an overhead in the amount of form elements, so you might be better off placing these "old" values on the server-side, either application class, model, server-side-cookie, ...