Have you ever wanted to hide the Go Back link for a particular page and for the certain condition? Well, I have! Sometimes, I want to hide that link since I don't want my web application's users go back to the certain page by clicking on the link for the particular pages only.
This following trick will show you how we can do it easily by using jQuery from the Client Scripts section of PHPMaker. Fortunately, PHPMaker has provided the special class for the link. Its name is ewLink, so that we can easily achieve it on the fly. This is important for us to know, especially if we want to handle it only for the certain pages. Client Scripts is the right place for this. No need to customize the generated script files at all.
In the following example, let's assume that we want to hide that link for the Add page which has condition only if there is a GET parameter in the URL which has name of userid. Of course, we will check the condition by using PHP, and if it returns true, then execute the action by using jQuery.
[hidepost]
- Open your PHPMaker project (.pmp) file using PHPMaker.
- Make sure you have already enabled Local YUI/jQuery files from Tools -> Advanced Settings. I always recommend to use this setting so we don't have to use the online file from Yahoo website.
- Now, click one of your desired tables from the Database pane in the left side.
-
Click on the Code (Server Events, Client Scripts and Custom Templates) tab, and then expand the following location: Client Scripts -> Table-Specific -> Add/Copy Page -> Startup Script, and then copy and paste the following code into the code editor pane in the right side:
<?php if (isset($_GET["userid"])) { ?> $(document).ready(function() { $('.ewLink').hide(); }); <?php } ?> - Re-generate your script files using PHPMaker as always.
[/hidepost]
Leave a Reply
You must be logged in to post a comment.