This topic is locked

Way to keep specific records from being edited

6/18/2015 3:08:52 PM
ASPRunnerPro General questions
G
guntherg author

I have a table of service records that the users are continually adding records to. From week to week, We will process those records up to a certain date. When certain service records are processed, they are marked by adding the processing date to a field named "ProcDate" in the table. The processed records are also marked by a checkbox field named "Processed". I want the users to have the ability to edit those records up to the time I process them. Before the records are processed, the ProcDate field is null and the Processed checkbox is equal to 0.
I am using ASPRunnerPro 5.2 (build 412). Looking at a previous post that attempted to perform this function by disabling the Save button on the edit page, I attempted to set a 'before display' event on the edit page with the following code:
if($values["ProcDate"] Is Not Null)

{

$xt->assign("save_button",false);

}

I even tried the code:
if($values["Processed"] == 1)

{

$xt->assign("save_button",false);

}

without success. Both attempts result in a 500-Internal Server Error when attempting to open the list page that the edit page is associated with.
Any suggestions to help with solving my issue with keeping users from editing records which have already been marked as processed? Thanks.

acaruson 6/18/2015



I have a table of service records that the users are continually adding records to. From week to week, We will process those records up to a certain date. When certain service records are processed, they are marked by adding the processing date to a field named "ProcDate" in the table. The processed records are also marked by a checkbox field named "Processed". I want the users to have the ability to edit those records up to the time I process them. Before the records are processed, the ProcDate field is null and the Processed checkbox is equal to 0.
I am using ASPRunnerPro 5.2 (build 412). Looking at a previous post that attempted to perform this function by disabling the Save button on the edit page, I attempted to set a 'before display' event on the edit page with the following code:
if($values["ProcDate"] Is Not Null)

{

$xt->assign("save_button",false);

}

I even tried the code:
if($values["Processed"] == 1)

{

$xt->assign("save_button",false);

}

without success. Both attempts result in a 500-Internal Server Error when attempting to open the list page that the edit page is associated with.
Any suggestions to help with solving my issue with keeping users from editing records which have already been marked as processed? Thanks.


Can you make the save button disappear with no condition given?

Do that first. Establish you can do that with no error.

Then try to create a condition.

admin 6/18/2015

The main issue is that you trying to use PHP code in ASPRunnerPro project.

G
guntherg author 6/19/2015



The main issue is that you trying to use PHP code in ASPRunnerPro project.


Is there a way to write the code in an ASPRunnerPro project to preform the same function? Do I need to go at it from a completely different approach?

admin 6/19/2015

You can use similar approach in ASPRunnerPro but in version 5.2 it will be difficult as you do not gave access to field values in BeforeDisplay event.
I.e. in ASPRunnerPro 9.0 you can use something like this:

if not IsNull(values("ProcDate")) then

xt.assign "save_button", false

end if
G
gonzalosb 8/6/2015

Hi Gene Gunther (AIMS),

You can try the following code base on asp help online. this will hide the edit button from the main page or save button on edit page.
Let's say you added a button to the datagrid to export a single record. And if the record has been already exported (value of field exported equals 1), you want to hide the export button in this row.
yellowbulbNote: Change the values listed in red to match your specific needs.

  1. Switch to HTML mode in Visual Editor and add wrappers around button's code. Here is the sample code:
    {BEGIN MyButton}
    <A class="rnr-button button" id="MyButton" href="#" typeid="ib">
    MyButton
    </A>
    {END MyButton}
  2. Now in the List page: AfterRecordProcessed event add the following code:
    if data("exported")<>1 then

    record("MyButton")=true

    end if
    This code will only display button if value of field exported equals 1.
    if you need help on editing this code let me know.. good luck on your project!!!