AnsweredAssumed Answered

Using a checkbox to trigger script

Question asked by on Jun 4, 2012
Latest reply on Jun 7, 2012 by

In the Checkout Book layout I am trying to get this checkbox (when checked) to create a new record in the Checkout Log layout. And when unchecked, it will delete the record created in the Checkout Log layout.

The problem is that WHENEVER I click in this box (to check or uncheck) the Remove from Loans script runs (see script below). So if the box is already unchecked and I try to check it (to create a new record), the custom dialog (part of Remove from Loans script) pops up.


Here are the 2 scripts. (FYI the checkout box displays data from Master::AssignCheckout, there is only one box to check called "yes"):

1. Checkout_AssignCheckbox

  • Go To Layout ["Checkout Log" (Checkout)]
  • If [Master::AssignCheckout = "yes"]
    • Set Variable [$patronID;Value:Patrons::zpatronID]
    • New Record
    • Set Field [Checkout::patronID; $patronID]
    • Commit Records
  • End If
  • Perform Script ["Remove from Loans"]
  • Go to layout [original layout]

2. Remove from Loans

  • Beep
  • Show Custom Dialog ["Are you sure you want to remove this book..."]
  • If [Get ( LastMessageChoice ) = 1] <<1=Cancel>>
    • Exit Script []
  • End If
  • Delete Record [No dialog]