Welcome Guest, Not a member yet? Register   Sign In
questions about forms
#6

[eluser]comex[/eluser]
One option is to create an array containing each field description and its type.
Eg.

$my_forms = array( array('desc'=>'Record label', 'type'=>'input'), [...] );

And then loop through $my_forms and just echo the corresponding HTML-code for each type.
Of course, this assumes that all of your fields follow the same "design pattern".
For the application I'm doing right now I wrote an model that generates forms from arrays.
Eg.

$forms = array( array('type'=>'input', 'name'=>'lala', 'style'=>'width: 1em;'), [...] );
echo $this->Tablegen->generate_forms($forms);

This has really cut the time spent HTML crunching. So if you're planning on having a lot of forms, something along those lines is(IMHO) worth looking at.


Messages In This Thread
questions about forms - by El Forum - 08-10-2009, 10:03 AM
questions about forms - by El Forum - 08-10-2009, 10:34 AM
questions about forms - by El Forum - 08-10-2009, 10:59 AM
questions about forms - by El Forum - 08-10-2009, 11:07 AM
questions about forms - by El Forum - 08-10-2009, 11:21 AM
questions about forms - by El Forum - 08-10-2009, 11:43 AM
questions about forms - by El Forum - 08-10-2009, 11:46 AM
questions about forms - by El Forum - 08-10-2009, 01:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB