Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Custom Verification Not Firing

I've got a custom javascript verification for a freeform item not firing off.

It passes through to the next question.  It starts off as follows:

alert("Start Verification");
var gift1 = new String();

And then pulls in the data strings but none of the alert events fire that let me know where it is in the process.

Any tips?
asked Jan 24 by Corey1975 Bronze (660 points)
retagged Jan 24 by Walter Williams
Are you setting a value to "strErrorMessage" somewhere in the verification?  If not, the verification won't stop the page from submitting.
strErrorMessage is not part of SSI 6.6.18 last I checked. As another note, these are textarea inputs.
Looks like the v6 equivalent is to set "bln_custom_result" to false.  Have you done that?  Can you post the whole code?
bln_custom_result is set to false automatically in the window. But even a hard reset doesn't work.  No matter what, the first alert doesn't fire. I've tried to set the custom verif to run both before and after standard verification.

Code is below:

alert("Start Verification");
var gift1 = new String();
var gift2 = new String();
var gift3 = new String();
var why1 = new String();
var why2 = new String();
var why3 = new String();

gift1= document.mainform['Q18_gift1'];
why1= document.mainform['Q18_why1'];
gift2= document.mainform['Q18_gift2'];
why2= document.mainform['Q18_why2'];
gift3= document.mainform['Q18_gift3'];
why3= document.mainform['Q18_why3'];
alert(gift1);
alert(gift3);
var testing = new Array();

if ((gift1.length == 0 && why1.length == 0) || (gift1.length > 0 && why1.length > 0)) {
    var testing[0] = 1;
    }
if ((gift1.length > 0 && why1.length == 0) || (gift1.length == 0 && why1.length > 0)) {
    var testing[0] = 0;
    alert("Correct Path");
    alert(testing[0]);
    alert(testing[1]);
    }

if ((gift2.length == 0 && why2.length == 0) || (gift2.length > 0 && why2.length > 0)) {
    var testing[1] = 1;
    }
if ((gift2.length > 0 && why2.length == 0) || (gift2.length == 0 && why2.length > 0)) {
    var testing[1] = 0;
    }

if ((gift3.length == 0 && why3.length == 0) || (gift3.length > 0 && why3.length > 0)) {
    var testing[2] = 1;
    }
if ((gift3.length > 0 && why3.length == 0) || (gift3.length == 0 && why3.length > 0)) {
    var testing[2] = 0;
    }

for (i=0, i<3, i++){
    if(test[i] == 0) {
        alert("yes");
        i++;
        alert("Please answer both questions for gift " + i + ".");
        i = 3;
        }
So if you set the verification to just this:

alert('test');


it still does not work?
It does. I tracked down the issue. I forgot to add the value property to document.mainform[]...

Your answer

Please only use this to answer the original question. Otherwise please use comments.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

To avoid this verification in future, please log in or register.
...