This topic is locked

Only one record

8/9/2018 7:54:45 AM
PHPRunner General questions
E
epanc author

Hi, is it possible to hide the "Add new" button after entering the first record? My requirement is that every user can enter only one registry.

Thank you.

HJB 8/9/2018
jadachDevClub member 8/9/2018

I do this often. You will need to translate into PHP (sorry).
Here is an example where I am hiding the add new button if a record with a certain combination of values already exists.
This scenario is a master detail set up.
On ListPage Before Process:

XVar data = pageObject.getMasterRecord();

if (data != null)

{

XSession.Session["MRN"] = data["MRN"].ToString();

XSession.Session["Measure"] = data["Measure"].ToString();

}
string strSQLExists = "select * from dbo.MeasuresDone where MRN='"+XSession.Session["MRN"].ToString()+"' and Measure='"+XSession.Session["Measure"].ToString()+"'";

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

XVar data1 = CommonFunctions.db_fetch_array(rsExists);

if(data1)

{

pageObject.setProxyValue("HideAddButton", 1);

}

else

{

pageObject.setProxyValue("HideAddButton", 0);

}


Then on ListPage JavaScript Onload:

var id = "addButton";

var button = $("[id^=" + id + "]");

if (proxy['HideAddButton']==1){

button.hide();

}
var id = "inlineAdd";

var button1 = $("[id^=" + id + "]");

if (proxy['HideAddButton']==1){

button1.hide();

}
E
epanc author 8/23/2018

Hi, for the moment, thank you all for your cooperation. I have just returned to work. I immediately try to follow your suggestions.