Expand my Community achievements bar.

Is There a Way to Pop Up a Message for a Timed Period?

Avatar

Level 1

Is there a way to temporarily throw up a pop up message then have it automatically cancel out on its own so the user is informed of a message without having to actually respond to it?

The idea is that I would "like" to be able to throw up a message to a user when they select and enter something into field A that they then must enter something in field B (which is dependent on a non-empty field in field A and ONLY then).  It's my work around to informing the user that they have effectively made field B required after entering something in field A.

If there isn't a way to throw up a timed message like this, are there other options/ideas?

Note:  Ideally, I simply wanted to be able to add a bunch of Javascript on the click event of a submit button in which I would validate all fields that need some validation of some sort (rather than have a series of pop ups occurring every time a field is clicked or changed).  In other words a one time validation for all fields on one event which would then prevent the button from doing a formSubmit() if any validation failed.

If you can tell me in what type of object and what event I could do the above, that would work too.  In fact, I think I'll have to do this anyway and I've tried a lot of different permutations of implementing this to no avail (i.e. a regular button, a submit button, an e-mail button on the click, change, mouseup, mouseup, etc. events).  But I appear to be doing something wrong because nothing I have tried is working (it appears as if none of the JS is triggering at all based on a simple app.alert not triggering).

MJS

2 Replies

Avatar

Level 6

I guess timed message is on the wish list

However in all my forms I use following scenario to validate all data entry at one time and then submit...

I use regular button and add code in Click event

JS example.....

var errorFlag = 0;

var errorMsg = "";

if (validation expression 1) {

     //true/pass

     //no need to change following values

     errorFlag = errorFlag;

     errorMsg = errorMsg;

}else {

    //false/fail

   //set the flag and message accordingly

    errorFlag = errorFlag + 1;

    errorMsg = errorMsg + "validation message1" + "\n"; //\n for new line with in the message

}

if (validation expression 2) {

     //true/pass

     //no need to change following values

     errorFlag = errorFlag;

     errorMsg = errorMsg;

}else {

    //false/fail

   //set the flag and message accordingly

    errorFlag = errorFlag + 1;

    errorMsg = errorMsg + "validation message2" + "\n"; //\n for new line with in the message

}

............

..............

..........

//finally

if (errorFlag > 0) {

    //>0 indicates there are one or more errors

    xfa.host.message(""+errorMsg);//display all messages at one time

    exit; //now since there are validation errors you can stop processing further and exit the event

}

//add submit code......here....

Avatar

Level 1

Varma_LC,

Thank you for responding but I guess I'm still missing something because I can't get any code to trigger.  I put a simple conditional statement in the click event of a regular button and it doesn't trigger.

So to make sure I'm getting this right, first of all, I'm using LifeCycle Designer 8.  I've created a regular button (type button, control type regular).  In the click event I have the following:

var tValidate = true;
var tMsg = "";

if (NOT(isEmpty(myField1.rawValue)))
{
  app.alert("myField1 has a value of - "+myField1.rawValue+".");
  if (isEmpty(myField2.rawValue))
  {
    tMsg = "Specify a value for myField2.";
    tValidate = false;
  }
}

if (tValidate == false)
{
  xfa.host.messageBox(""+tMsg,1,0);
  exit;
}

All of my objects are at the same level in the hierarchy so should be accessible without fully qualifying their names.  The above code works in the form validate event (I was throwing it into all sorts of objects/event to get it to trigger from somewhere) so I know the code itself works (testing it be supplying something in myField1 but not in myField2).  It just doesn't trigger from a button (and I've tried various events in an email button all of which failed).

So 'any' help directing me to why this doesn't work so that I can start writing all my validations would be so appreciated!