This topic is locked
[SOLVED]

 How to make tooltip conditionally appear

9/9/2017 10:05:57 AM
PHPRunner General questions
E
exora author

I am new in programming and in phprunner. I am using phprunner 9.8 Build 29465.
I have read about using field events in https://xlinesoft.com/blog/2017/07/25/using-field-events/#more-1667.

I will implement this method to other case. I have a table with fields "fullname", "address", and "phone".
How to make code so if user type name in "fullname" that have exist in table, the tooltip appear with certain message. I need this code because duplicate value is allowed.
Thank you.

jadachDevClub member 9/9/2017

Maybe this can point you in the right direction: https://xlinesoft.com/blog/2017/07/25/using-field-events/

E
exora author 9/9/2017



Maybe this can point you in the right direction: https://xlinesoft.com/blog/2017/07/25/using-field-events/


Thank you for quick response.

I have read the link as I mention in my posting. But I don't understand about step 3 (Client After).
I make code:
Client Before:
params["value"] = this.getValue(); // default sample
Server:
$result["owner"] = "select fullname from t_property where fullname='".$params["value"]."'";
Client After:
if(result['owner'])

{

$result["message"]="It seems the same owner"

$("#fullname_tip").remove();

$("input[id=value_fullname_1]").after("<div id='fullname_tip' style='margin-top: 10px; color: blue;'>"+result["message"]+"</div>");

}
That doesnt work. It may be simple but honestly I just guess the code. I am new in programming

jadachDevClub member 9/9/2017



Thank you for quick response.

I have read the link as I mention in my posting. But I don't understand about step 3 (Client After).
I make code:
Client Before:
params["value"] = this.getValue(); // default sample
Server:
$result["owner"] = "select fullname from t_property where fullname='".$params["value"]."'";
Client After:
if(result['owner'])

{

$result["message"]="It seems the same owner"

$("#fullname_tip").remove();

$("input[id=value_fullname_1]").after("<div id='fullname_tip' style='margin-top: 10px; color: blue;'>"+result["message"]+"</div>");

}
That doesnt work. It may be simple but honestly I just guess the code. I am new in programming


I was able to do this by using field events, however I use C# not PHP. So the server part will need to be translated from C# to PHP. The client before and client after will be the same.
In my scenario, I want users to know if the Job Title entered exists or not.

Client Before:
params["val"] = this.getValue();
Server:
string strSQLExists = "select * from Careers.dbo.Jobs where JobTitle='"+parameters["val"].ToString()+"'";

XVar rsExists = CommonFunctions.db_query(strSQLExists, null);

XVar data = CommonFunctions.db_fetch_array(rsExists);

if(data)

{

result["newJobTitle"] = parameters["val"].ToString() + " " + "exists";

}

else

{

result["newJobTitle"] = parameters["val"].ToString() + " " + "does not exist";

}
Client After:
$("#JobTitleTip").remove();

$("input[id=value_JobTitle_1]").after("<div id='JobTitleTip' style='margin-top: 10px; color: red;'>"+result["newJobTitle"]+"</div>");
E
exora author 9/10/2017



I was able to do this by using field events, however I use C# not PHP. So the server part will need to be translated from C# to PHP. The client before and client after will be the same.
In my scenario, I want users to know if the Job Title entered exists or not.

Client Before:
params["val"] = this.getValue();
Server:
string strSQLExists = "select * from Careers.dbo.Jobs where JobTitle='"+parameters["val"].ToString()+"'";

XVar rsExists = CommonFunctions.db_query(strSQLExists, null);

XVar data = CommonFunctions.db_fetch_array(rsExists);

if(data)

{

result["newJobTitle"] = parameters["val"].ToString() + " " + "exists";

}

else

{

result["newJobTitle"] = parameters["val"].ToString() + " " + "does not exist";

}
Client After:
$("#JobTitleTip").remove();

$("input[id=value_JobTitle_1]").after("<div id='JobTitleTip' style='margin-top: 10px; color: red;'>"+result["newJobTitle"]+"</div>");



Thank you very much