Guide 13 - New types of data entries. Integration of JavaScript. |
4/29/2021 4:25:36 PM |
PHPRunner Tips and Tricks | |
![]() I have been creating PHPrunner plugins and a large set of possibilities is available. On some occasions I have had requests to make EDIT type plugins that I have not been able to integrate since this type of code requires that the JavaScript code has a special structure and characteristic and how I indicate, many of them do not fulfill it. It also requires that you adjust to the jQuery versions (v. 1) and Bootstrap (V.3), which Phprunner incorporates. Objective: Explanation how you can include JavaScript plugins as an information entry field (ADD and EDIT) without having to write/make a PHPRunner Plugin. If you are interested in this information and want to download the example, see this article. |
|
![]() |
fhumanes author 4/29/2021 |
Objective: Explanation How you can include JavaScript plugins as an information entry field (ADD and EDIT) without having to write / make a PHPRUNNER plugin. DEMO: https://fhumanes.com/edit_plugin. TECHNICAL SOLUTION: This solution is not being able to be similar to PHPrunner Plugins, as it will lack the possibility of "on line" operation and will only work on new pages for ADD and EDIT (only one instance of the plugin on the page). Although the example is built with version 10.2 of phprunner, the method used serves for 9.x and 10.x versions. What we want to do in the example is to use the entry specified in this URL: https://bootsnipp.com/snippets/dgwp To get this result:
To include all the code (CSS, HTML and JavaScript) that requires the new edition we will use the "Code Snippet" functionality and we will include it next to the presentation of the field that will contain the value resulting from that entry. So that the entry is not duplicated, the receiving field will indicate, through JavaScript that hide() is hidden. We need this field so that PHPRunner receives the corresponding value and saves it in the database, but we want the way to edit (HTML presentation) has the special format that we have chosen. In the "JavaScript Onload" event we will have this code: var ctrlNumber = Runner.getControl(pageid, 'Number_value'); If you set, this code does:
You have to take into account other types of details, such as:
I also put the code to generate the HTML code that requires the presentation field, usting in each case will require different code, but, surely, it can be created in this same way (Snippet code and "minus_and_plus.php"). $value = $_SESSION['Number_value']; I'm sorry, I can not put the code for problems of this forum. I leave the example code so that you can install and review on your PC. In this URL you will be able to find many javascript plugin that you can incorporate to your developments https://www.jqueryscript.net/ For any questions or concerns, you can I communicate with me through my email fernandohumanes@gmail.com |