This topic is locked
[SOLVED]

 How to clear a message in OnAfter()

11/18/2010 12:39:07 AM
PHPRunner General questions
B
brhipple author

I am creating a health care application that needs to be HIPAA compliant. I want to only display a client's SSN temporarily when a button s pressed otherwise it just displays only the last 4 digits of the SSN. I have added the button and all works well, except that I don't know how to clear the message that displays the SSN. I tried the following:
function OnAfter(result,ctrl)

{

// this message includes the SSN

var message = result["txt"] ;

ctrl.setMessage(message);
// clear the message after 5 seconds

setTimeout("clearmessage()", 5000);

function clearmessage()

{

var message = "" ;

ctrl.setMessage(message);

}

}
Do you all know what I might be doing wrong or another way of accomplishing my objective?

Sergey Kornilov admin 11/18/2010

You need to change function description a little bit and pass ctrl variable to this function. Here is how it going to work.

// this message includes the SSN

var message = result["txt"] ;

ctrl.setMessage(message);
// clear the message after 5 seconds

setTimeout(function(ctrl) {

ctrl.setMessage("");

}

, 5000, ctrl);
B
brhipple author 11/18/2010

Thanks Sergey, this works well!