Disable a field with server event

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
mpol_ch
User
Posts: 896
Location: Switzerland

Disable a field with server event

Post by mpol_ch »

Hi,
I am trying to avoid the editing of field "Kostenstelle" with below code but it does not work.
The field is a lookup field with activated option "use modal dialog for lookup".
Any idea?
I am inserting the following code for Edit Page / Page Load

          function Page_Load() {
             // Check if it's an edit operation
              if ($this->IsEdit) {
                      $this->Kostenstelle->ReadOnly = true;
              }
          }

mpol_ch


sticcino
User
Posts: 1090

Post by sticcino »

wrong event

**function Page_Render()**
{
	$this->EmployeeId->ReadOnly = true;
        $this->EmployeePassword->Visible = false;
}

mpol_ch
User
Posts: 896
Location: Switzerland

Post by mpol_ch »

I solved it with following code:

      function Row_Rendered() {
      // Get a field value of ks_gueltig from Kostenstelle
      $currentKostenstelle = $this->Kostenstelle->CurrentValue;
      if ($currentKostenstelle !== null && $currentKostenstelle !== '') {
        $ks_gueltig = ExecuteScalar("SELECT ks_gueltig FROM kostenstelle WHERE ksid=".$this->Kostenstelle->CurrentValue );
          if ($ks_gueltig == 0) {
        $this->Kostenstelle->EditAttrs["disabled"] = "disabled";
     }
 }
}

mpol_ch


Post Reply