How to use Default Datepicker for your Custom module in Frontaccounting
- Article
- Comment (3)
How to use Default Datepicker for your Custom module in Frontaccounting. This is one of a simple tutorial to help you to use the default date picker for your custom module development and extension creation.
Let’s start with some basic aspect. Frontaccounting itself, it doesnot allow other popular JS and PHP fraemworks for operations.But they coded for some functions. So just inherit to use our own requirment. When you start creating a module, you need to write the following things
<?php $page_security = 'HR_EMPL_INFO'; // For the purpose of Access permission $path_to_root="../.."; // path to the root of your frontaccounting installation. include($path_to_root . "/includes/session.inc"); // Manage User sessions with this class. include($path_to_root . "/includes/ui.inc"); // Includes all the visual components of Frontaccoutning. page(_("Employee Informations")); //Title of your page start_page(); end_page(); ?>
The above code helps you to create a blank page with frontaccounting visuals. But in default it wont help you to use datepicker with the ui inclusion. So its separate JS. so just use the following code snippet to get datepicker.
$js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 500); if ($use_date_picker) $js .= get_js_date_picker();
Add the above lines before setting the page title.
Also which requires to include a js file to render the datepicker. So use the following line of code to get the datepicker.
include_once($path_to_root . "/includes/date_functions.inc");
That’s it now the datepicker is ready to work .Test the function using the following code.
start_table(); date_row(_("Joining") . ":", 'join_date'); end_table();
Hi, Can i ask, how can i add minimum date on frontaccounting datepicker. Ex Date today would be the starting date less than today’s date cant be selected.
Thanks!
Hi, Do you know how to add minimum date on fa default datepicker, Kindly help please, thanks
You can add it on your code. Check it with jQuery datepicker library