Many users wonder which files should they upload to their web server after adding a new table to AppGini and generating the app. Of course, you could just upload everything and you’d be on the safe side. But sometimes you might be working over a slow network or a metered data connection and don’t have […]
Author Archives: Genedy
How to allow numbers only in a field?
Let’s say you have a numeric field, maybe a price, a score or some other field that should contain numbers only. If you set the data type of the field in AppGini (or in your database) to be numeric (INT, DECIMAL, FLOAT … etc) that would allow only numbers to be stored in the database. […]
How to hide the seconds in a time field?
If you have a time field in your AppGini application, it displays a time picker in the detail view like this one: The timepicker includes seconds. If you wish to hide the seconds part, you could do so by editing the tablename_dv hook. Open the generated hooks/tablename_dv.php file in a text editor (where tablename is […]
Auto save a new record without having to click ‘Save as copy’
An AppGini customer told me recently that he has a table containing only one field, a barcode field, that he uses a barcode scanner to populate. He has thousands of items to enter, and wanted to know if there is someway to expedite his workflow, maybe by avoiding to click ‘Save as copy’ everytime he […]
Programmatically change the value of an image field in the detail view
In the detail view, if you have some ajax request running in the background that should update your detail view form (or if you do this in the tablename_dv hook), you might already know that you can change the data of a normal text field using this JavaScript code:
1 |
$j('#fieldname').val('new value'); |
But if your field is […]
Creating an ON/OFF switch using bootstrap and jQuery
In some projects that I work on, I need a quick way of adding some cool-looking user-friendly on/off switch. Checkboxes are ugly! And I don’t want to add a new component/plugin to the already loaded pages. So, I wrote some quick code snippet for a switch based on Bootstrap 3 and jQuery. Here is the […]
Prepare a LAMP web development server on Amazon EC2
Here is a quick checklist for setting up LAMP development server on Amazon EC2. I used a standard Amazon Linux AMI on a T2.micro instance, which costs about $9/month at the time of writing this. Edit the DNS zone for your domain to add an A record for a sub-domain to point to the public […]
How to paginate a database query in PHP — the no-frameworks way
OK, I admit! Every time I have to write similar code I get stuck rethinking it — every time … If I wasted 10 minutes thinking of it every time, and I did so for 100 times, then I’ve already wasted more than 2 working days in the last 12 years doing it! I guess […]
Making sure a PHP script is accessible only through being included
Let’s say we have a PHP script that we don’t want users to access directly by calling it through their browser. We want that script to be included in other scripts but not accessed by typing its URL. A lot of sites suggest saving such scripts into a directory outside the document root. This would […]
Bootstrap 3 break points
For more information about break points and using them with Bootstrap 3 grid system, please refer to the Bootstrap documentation.