Disable Button in certain conditions

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
apis
User
Posts: 124

Disable Button in certain conditions

Post by apis »

i want to disable edit button in two condition:

1 - lets say i have two radio buttons in record add page one as " Save" and the other as "Draft"
2 - as long as user adds the record with "Draft" radio button selected, edit function is enabled
3 - if the user saves the record with " Save " radio button selected, then record cannot be edited.

can anybody please help me to do this.
Thank you


mobhar
User
Posts: 11660

Post by mobhar »

You may simply use jQuery in order to disable the button based on the radio button selected. Put it in "Startup Script" under "Client Scripts" section that belongs to the "Add/Copy Page" and/or "Edit Page".

Just Google for that.


arbei
User
Posts: 9288

Post by arbei »

You can hide the edit button in list page by the value of the other field by adding code in "ListOptions_Rendered" Server Event.

For example:
if ($this-><Field>->ViewValue == "<value>")
$this->ListOptions->Items["edit"]->Body = "";

Read help file topic: "Server Events and Client Scripts" -> "ListOptions_Rendered" for more information.


Piosky_to2003
User
Posts: 23

Post by Piosky_to2003 »

I solved it by entering in
In Client Scripts -->Tablet_Specific-->List Page-->Startup Script
$(document).ready(function() {
$(".ewAdd").hide(); // hide Add button
$(".ewDetailAdd").hide(); // hide Add master/detail button
});


Post Reply