it's possible not see the buttons to update and delete...

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
danielefeola
Veteran Member
Posts: 30
Joined: 2013-04-19 13:36

it's possible not see the buttons to update and delete...

Post by danielefeola » 2015-06-10 09:26

Hello everyone,
it's possible not see the buttons to update and delete, if the record satisfies a condition?
For example, a record with the status 'closed' by a supervisor, it can not be modified or deleted by the owner.

Suggestions?

Thanks!

User avatar
shasta59
AppGini Super Hero
AppGini Super Hero
Posts: 231
Joined: 2013-01-08 19:40
Location: Calgary, Alberta, Canada

Re: it's possible not see the buttons to update and delete...

Post by shasta59 » 2015-06-11 01:16

What version are you using. Please put that in your question as it makes it easier to answer.

For example I use 5.31

See this topic at the AppGini site.

http://www.bigprof.com/appgini/help/adv ... ific-hooks

Look for tablename_before_update()

The code is in there to do what you want. It will not hide the buttons but will not let the user overwrite the record. I have used this code and put up an alert saying they cannot modify the record due to the Full Moon or some other reason.
The other option you could do is use jquery to look to see if it satisfies a condition and disable the fields so they cannot be modified.
Or use jquery to look for the condition and then use jquery to hide the buttons if the user is not a supervisor.

I would suggest, with the jquery code you also put in an alert stating the user cannot modify the contents due to X reason.

There are many ways you can do it.

Alan
Calgary, Alberta, Canada - Using Appgini 5.50 -

danielefeola
Veteran Member
Posts: 30
Joined: 2013-04-19 13:36

Re: it's possible not see the buttons to update and delete...

Post by danielefeola » 2015-06-12 09:47

Hello Alan,
the version I use is the 5.40.752 - upgrade from 5.31

The function before_update is already implemented for security.
But I want to save time and resources of the web server, hiding the buttons to update and delete.

I wrote functions jquery, although it is not my responsibility, but I can not catch the hidden value of a lookup, to make an if condition.
I can hide the buttons:
jQuery (document) .ready (function () {$$ ('# update'). invoke ('hide');});

In version 5.40 it did not work either simple: $ ("# ..."). Val ();

But they are not very expert jquery!

thanks
Daniele

danielefeola
Veteran Member
Posts: 30
Joined: 2013-04-19 13:36

Re: it's possible not see the buttons to update and delete...

Post by danielefeola » 2015-06-12 10:22

Okay I solved with your post
http://forums.appgini.com/phpbb/viewtop ... f=8&t=1482

I write if condition from sql query and hide button!

I did not understand because of header-extras is not working with only jquery.

thanks

pfrumkin
Posts: 3
Joined: 2020-02-18 17:58

Re: it's possible not see the buttons to update and delete...

Post by pfrumkin » 2020-03-24 17:18

I realize that this is a fairly old post. I am using AG 5.82.

I struggled with this for a bit using the hook and the header.php file, but it turned out to be quite simple. I added the line

$j( '#myChildTable_add_new' ).hide();

to tablename-dv.js

tablename is a table with lookup to ChildTable. This hides the Add New button for the ChildTable dropdown. You have to view source on the page to see how AG is naming the controls.

~Paul

Post Reply