[eluser]Sbioko[/eluser]
Hi, i developed a new library: DV_FormGen! As you understood, this is Form Generation Library.
Features:
*Input(text) fields
*Textarea fields
*Hidden fields
*File Upload fields
*Custom attributes
*JavaScript attributes
*Submit & Reset fields
*Checkboxes and Radios
*Inserting checkboxes or radios in one line
*Generating in <table> tag
*If you didn't find field you need, you can add you own!
Known Issues:
*Problems with
checked attribute in checkbox fields
*JavaScript attributes not working, because of this(example of generating result):
Code:
<input type="text" name="field" onfocus="if(this.value=="") { this.value="Value"; }">
So, problem is: Dual double quotes. If you're know how to repair it, please write!
*If you are find some new issues, please write in this topic or email me!
Attention: this is BETA!
Sample Code:
Code:
<?php
$this->load->library('dv_formgen');
$fields=array(
0 => array(
'type' => 'hidden',
'name' => 'hidden_field'
),
1 => array(
'type' => 'text',
'name' => 'text_field',
'constraint' => 255 // Maxlength. DBForge, yeah? :)
'default' => 'Default value',
'show_name' => 'Text Field'
),
2 => array(
'type' => 'textarea',
'name' => 'textarea_field',
'constraint' => array(100,20) // Cols and Rows respectively
'default' => 'Default value',
'show_name' => 'Textarea Field'
),
3 => array(
'type' => 'file',
'name' => 'file_upload_field',
'default' => 'Default Value',
'show_name' => 'File Upload'
),
4 => array(
'type' => 'radio',
'default' => 'Default Value',
'name' => 'radio[]',
'title' => 'Radio Group #1'
),
5 => array(
'type' => 'radio',
'default' => 'Default Value #2',
'name' => 'radio[]',
'title' => 'Radio Group #1'
),
6 => array(
'type' => 'multiple_radio',
'title' => 'Radio Group #1' // Outputs all the radios of Radio Group #1
),
7 => array(
'type' => 'submit',
'default' => 'Submit'
)
);
$this->load->view('page',array('form' => $this->dv_formgen->generate($fields)));
?>
Put this in some method of controller. Any questions? Write!