Welcome Guest, Not a member yet? Register   Sign In
DV_FormGen 1.0 beta
#1

[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:
&lt;input type="text" name="field" onfocus="if(this.value=="") { this.value="Value"; }"&gt;
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:
&lt;?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)));
?&gt;
Put this in some method of controller. Any questions? Write!
#2

[eluser]davidbehler[/eluser]
@JS problem:
Try using single quotes or escaping the quotes witha backslash
#3

[eluser]Sbioko[/eluser]
waldmeister, thanks a lot. I forgot about backslash!
In future this library will generate forms from database tables.




Theme © iAndrew 2016 - Forum software by © MyBB