form parameters not being passed to another form correctly

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

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

form parameters not being passed to another form correctly

#1

Postby Segi » Wed Sep 07, 2016 4:49 pm

A while back I wrote a snippet of code to pass the name and value pair of all my form fields except for a few specific fields from one form to another and everything used to work correctly but now something has changed and it doesn't work right anymore. It seems that the array gets corrupted/changed when it gets passed from one form to another.

This is how I encapsulate them in the calling form:

Code: Select all

var filters=new Array();

// Loop through all fields and add them to an array
for ( var field in Iterator(fields.iterator()) ) {
     // Do not add these fields
     if (field.value != null && field.elementName != "MENU" && field.elementName != "REALNAME" && field.elementName != "FILTER_PARAMETERS") {
          filters.push([field.elementName,encodeURIComponent(field.value)]);
     }
}

var parms = {};
parms.FILTER_PARAMETERS=filters;
parms.Menu=true;

form.gotoForm("MTS_DTL",parms);
If I print the value of parms.FILTER_PARAMETERS right before the call to gotoForm, it correctly shows an array with all of the field names and values.

The form being called, MTS_DTL, has a FILTER_PARAMETERS field that has the URL parameter property set. If I print out the value of fields.FILTER_PARAMETERS.value in the before page event of MTS_DTL, the log file shows me org.mozilla.javascript.NativeArray@44a47538 and cannot be accessed like a JavaScript array. IF I print out the results of Array.isArray(fields.FILTER_PARAMETERS.value) it returns false.

What could have changed to cause this ? Would switching to https change the way parameters are passed from one form to another ? It never used to do this.
0 x

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

#2

Postby Jon » Thu Sep 08, 2016 8:29 am

It's a bug - I've logged it and we will try to fix it in the next release. I think it was introduced in V5.1 by a bug fix for another problem. In the meantime I think the only way to make this work is to pass Javascript objects - arrays and objects - as JSON strings, and change the receiving field fron type OBJECT to type CHAR.
0 x

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

#3

Postby Segi » Thu Sep 08, 2016 3:37 pm

Thanks,

I've rewritten this logic for now so it uses a database now to store the values before going to the next form.

Segi
0 x


Who is online

Users browsing this forum: No registered users and 7 guests