audit fields value changes on a form

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

audit fields value changes on a form

#1

Postby xren » Fri Mar 04, 2016 5:17 pm

Hi,

Is there any audit functions provided by ebase to record fields values on a form changed by user when submit from old to new and we can record that values are changed and old values are xxx and new data are xxx


Thanks,
Xiaoli
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Fri Mar 04, 2016 5:53 pm

This sounds the same question as this http://forum.ebasetech.com/forum/viewtopic.php?t=1013
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

#3

Postby xren » Fri Mar 04, 2016 10:16 pm

Yes and No.

What we want to do is to remember all input fields' value before page render, then check if any field's value changed, if yes then save both old value and new value to audit table for future reference.

If no available function from ebase, is there a way at the back to iterate all fields to get their name and value?

Thanks,
Xiaoli
0 x

Steve James
Ebase User
Posts: 331
Joined: Mon Mar 10, 2014 8:34 am

#4

Postby Steve James » Sat Mar 05, 2016 7:38 am

is there a way at the back to iterate all fields to get their name and value?
Have a look at http://dev-docs.verj.io/ufs/doc/javadoc ... ields.html

Code: Select all

for ( var field in Iterator(fields.iterator()) )
 {
    log(field.elementName);
 } 
As for before and after values, I occasional create a copy of the db backed table and then can compare values when the user hits the save button.
0 x

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

#5

Postby t4nu » Sat Mar 05, 2016 10:11 am

are your controls link to the field of the table or to the item in the fields?
if the input controls is linked to the items in the field tab then you can compare the value in that item with the item in the field table, if something change then save otherwise go to other thing.

if the input controls are linked to the field in the table, then seems you have to have a backup database resource that will be fetched then the values are compared to the values of the input fields.

xren wrote:Yes and No.

What we want to do is to remember all input fields' value before page render, then check if any field's value changed, if yes then save both old value and new value to audit table for future reference.

If no available function from ebase, is there a way at the back to iterate all fields to get their name and value?

Thanks,
Xiaoli
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

#6

Postby xren » Mon Mar 07, 2016 3:37 pm

Thank you all for the input.
0 x

mkushwaha
Ebase User
Posts: 29
Joined: Mon Nov 02, 2015 7:19 pm

#7

Postby mkushwaha » Wed Apr 20, 2016 5:40 pm

@Steve James

Could you provide a proper link that works to check out the documentation for http://dev-docs.verj.io/ufs/doc/javadoc ... ields.html

log(field.elementName) just prints the element name. How does one print element value ?

Thanks.
0 x

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

#8

Postby t4nu » Thu Apr 21, 2016 2:16 am

Is log(field.value) work?

mkushwaha wrote:@Steve James

Could you provide a proper link that works to check out the documentation for http://dev-docs.verj.io/ufs/doc/javadoc ... ields.html

log(field.elementName) just prints the element name. How does one print element value ?

Thanks.
0 x

Hovik
Moderator
Moderator
Posts: 184
Joined: Tue Sep 11, 2007 8:58 am

#9

Postby Hovik » Thu Apr 21, 2016 9:31 am

The url has changed to http://dev-docs.verj.io/ebase/doc/javad ... ields.html

field.elementName gives you the field name.
e.g.
for ( var field in Iterator(fields.iterator()) )
{
log("Field " + field.elementName + " has value of: " + field.value );
}
0 x

mkushwaha
Ebase User
Posts: 29
Joined: Mon Nov 02, 2015 7:19 pm

#10

Postby mkushwaha » Thu Apr 21, 2016 12:43 pm

Thanks Hovik& t4nu, that works!

I did the same thing with Tables.

Code: Select all

for (var table in Iterator(tables.iterator())){
	log("table:"+table.elementName);
}
How does one prints values for each row and columns ?
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#11

Postby Jon » Thu Apr 21, 2016 2:01 pm

Something like this:

Code: Select all

for (var table in Iterator(tables.iterator())){
   log("table:"+table.elementName);
   var rows = table.rows;
   while (rows.next()) {
   	 for each (var column in table.columns) {
   	 	 log("column:"+column.elementName + " value: " + column.value);
   	 }
    }
} 
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#12

Postby Jon » Thu Apr 21, 2016 2:05 pm

Or you could use the new table.toJSON() method in V5.1:

Code: Select all

for (var table in Iterator(tables.iterator())){
   log("table:"+table.elementName);
   log(table.toJSON());
} 
0 x


Who is online

Users browsing this forum: No registered users and 7 guests