How to Create Form Components in Frontaccounting
X

Congrats, You are Subscribed to Receive Updates.

How to Create Form Components in Frontaccounting


How to Create Form Components in Frontaccounting is the question comes, when you started creating modules for Frontaccounting. Here I am going to discuss with some of the form components and how to create it inside Frontaccounting. Lets begin with a sample file. Here is an empty file for HRM employee profile

<?php
/**********************************************************************
 AuthoR : Kvvaradha
 
 Module : HRM 
 
 Developed to 1Stop WebSolution.com
 
***********************************************************************/

$page_security = 'HR_EMPL_INFO';
$path_to_root="../..";
include($path_to_root . "/includes/session.inc");
$js = "";
if ($use_popup_windows)
	$js .= get_js_open_window(900, 500);
if ($use_date_picker)
	$js .= get_js_date_picker();
	
include($path_to_root . "/includes/ui.inc");
include($path_to_root . "/hrm/includes/hrm_ui.inc");
include($path_to_root . "/hrm/includes/hrm_db.inc");
include_once($path_to_root . "/includes/date_functions.inc");

page(_("Employee Informations"));	


end_page();
?>

This is a sample page, which will create an empty page with Title of “employee Information “. We are going to create form inside it,

fa-forms

Definitely we need some most important forms to perform edit operations. Here we are going to use the following items.

  • Textbox
  • Textarea
  • Select Options
  • Checkbox
  • Button
  • DatePicker

These are the most used form components for Frontaccounting for creations , Lets see each components with example functions.

1.Textbox :

Total frontaccounting is built with Tables and forms, So we need to use all the things inside the table. Now the following code will help you to show a text box with Label,

text_row(_("Employee Name:"), 'EmplName', $_POST['EmplName'], 40, 80);

Here text_row() function will help you to render a table row  with a label and textbox,

_(“Employee Name: “)    is a function which carries the label and shows it infront of the textbox

‘EmpName    is the component name which will help you to handle the data retrieval operations.

$_POST[‘EmpName’]  — Will retrieve the value, when we select an employee from  the select employee drop down list.

2.Textarea :

textarea_row(_("Present Address:"), 'pre_address', $_POST['pre_address'], 35, 5);

This one is also exactly matches the above parameter’s, which are also the same purpose here.

3.Select Options :

kv_empl_gender_list_row( _("Gender:"), 'gender', null);

The above function kv_empl_gender_list_vew is a custom function. we need to write function for the gender list.  so the following code helps you to understand it.

function kv_empl_gender_list_row($label, $name, $selected_id=null, $submit_on_change=false) {
	global $kv_empl_gender;
		
	echo "<tr><td class='label'>$label</td><td>";
	$options = array(
	    'select_submit'=> $submit_on_change
	);
	echo array_selector($name, $selected_id, $kv_empl_gender, $options);
	echo "</td></tr>\n";
}

The above function will get you the gender list , but you need to provide the array of the data for the gender list, Here is the array,

$kv_empl_gender = array(
    1 => _('Male'),  
    2 => _('Female'), 
    3 => _('Other'), 

);

That’s it for the Select options, Likewise you can play with the database querying and getting lists from the database for large volume of data.

4.Checkbox :

check_row(_("PF*:"), 'empl_pf', null);

Nothing special in the above function, you can understand it well based on the above things.

5. Button :

submit_center('submit', _("Add New Employee"), true, '', 'default');

This will create a submit button Here.

6. DatePicker:

	date_row(_("Date of Birth") . ":", 'date_of_birth');

This is not enough to show the datepicker, you need to use the below code to get datepicker.

$js = "";
if ($use_popup_windows)
	$js .= get_js_open_window(900, 500);
if ($use_date_picker)
	$js .= get_js_date_picker();
	
include_once($path_to_root . "/includes/date_functions.inc");

Else, you cant see the datepicker there. That’s it for form component creation.

commenter

About Varadharaj V

The founder of Kvcodes, Varadharaj V is an ERP Analyst and a Web developer specializing in WordPress(WP), WP Theme development, WP Plugin development, Frontaccounting(FA), Sales, Purchases, Inventory, Ledgers, Payroll & HRM, CRM, FA Core Customization, OpenCart Theme Development, PHP, HTML, CSS, jQuery, Bootstrap development and content SEO.

One comment

  1. commenter

    Hi,

    Can you please share, how to add the image upload field for employee form?
    Thanx so much in advance….

Comment Below

Your email address will not be published. Required fields are marked *

*

Current ye@r *

Menu

Sidebar

Subscribe E-mail Updates

Congrats, You are Subscribed to Receive Updates.

Advertisement

Category Posts