progmax / php-form-builder-class

Automatically exported from code.google.com/p/php-form-builder-class
GNU General Public License v3.0
0 stars 0 forks source link

Support fieldsets/legends #44

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It is often needed on larger sized forms, the use of field-sets to separate
groups of input.

We could do something like:

$form->openFieldset("This is the fieldset legend");
$form->addWebEditor("Web Editor - TinyMCE:", "field2");
$form->addCKEditor("Web Editor - CKEditor:", "field3");
$form->closeFieldset;
$form->openFieldset("Another Fieldset!");
$form->addPassword("Password:", "field4");
$form->addFile("File:", "field5");
$form->addDate("Date:", "field6");
$form->closeFieldset;

There is probably a neater way to do it... but it should support nesting of
fieldsets.

Original issue reported on code.google.com by moncojhr@gmail.com on 21 May 2010 at 7:34

GoogleCodeExporter commented 9 years ago
The addHTML form element could also be used to insert the appropriate markup 
for fieldsets/legends.

Original comment by ajporterfield@gmail.com on 23 May 2010 at 4:19

GoogleCodeExporter commented 9 years ago
Hi, because the addHtml element gets wrapped in div's it is not possible to use 
it to
wrap other elements.

I don't remember if we used to have the addHtml raw, without that table stuff 
around
it or not.

Original comment by moncojhr@gmail.com on 24 May 2010 at 3:59

GoogleCodeExporter commented 9 years ago
I committed a patch for this:
http://code.google.com/p/php-form-builder-class/source/detail?r=218

We'll see if it stays... it doesn't work correctly when your using the map thing

Original comment by moncojhr@gmail.com on 7 Jun 2010 at 2:26

GoogleCodeExporter commented 9 years ago

Original comment by moncojhr@gmail.com on 7 Jun 2010 at 3:22

GoogleCodeExporter commented 9 years ago
Oh excellent .. I'm just looking into this form class, found it didn't have 
fieldset
support, then the issue was already know, and a 'possible' solution already
available. I'm not needing the advaced map feature right now so I'll test the
implimentation of it and let you know if I find any other issues. 

Original comment by eli...@gmail.com on 7 Jun 2010 at 10:07

GoogleCodeExporter commented 9 years ago
Hey great, tell me what you think... maybe there is a better way to create the
fieldsets... not sure... 

I'm not really sure about how you would expect to use fieldsets and the layout 
map
option... ill play around with it a bit later.

Original comment by moncojhr@gmail.com on 7 Jun 2010 at 11:15

GoogleCodeExporter commented 9 years ago
Because of the newly added noDiv element attribute, the html element type can 
be used for fieldsets.  The openFieldSet/closeFieldSet functions are not 
essential and have been removed in r222.  The addHTML() function can be used to 
add fieldsets as seen below.

$form->addHTML('<fieldset><legend>My Fieldset</legend></fieldset>', 
array("noDiv" => 1));

//Add some elements inside the fieldset here.

$form->addHTML('</fieldset>', array("noDiv" => 1));

Original comment by ajporterfield@gmail.com on 8 Jun 2010 at 12:55

GoogleCodeExporter commented 9 years ago
The fieldset itself is working like suggested in comment 7. 

The fieldset is not working if you use it with the map element.

Original comment by sven.lar...@gmail.com on 8 Jun 2010 at 3:22

GoogleCodeExporter commented 9 years ago
Yep, you're correct Sven.  We're looking into this and will keep this thread 
updated with our progress.

- Andrew

Original comment by ajporterfield@gmail.com on 8 Jun 2010 at 3:30

GoogleCodeExporter commented 9 years ago
Hi, Andrew, I still think we should keep "openFieldSet" and "closeFieldSet" 
even though you can create this using the addHtml method... after-all you could 
create many of the elements using addHtml. I think field-sets are used enough 
to warrant including methods to create them.

A way I'm thinking to get the fieldsets to work somewhat using "map" would be 
to use the "simple html" branch and then extending noDiv to remove the single 
wrapping div. 

That would work fine as long as the person adds the fieldset around a complete 
row...

Original comment by moncojhr@gmail.com on 9 Jun 2010 at 1:16

GoogleCodeExporter commented 9 years ago
Agreed.  I have re-added openFieldset/closeFieldset functions which then reuses 
the html element.  See the code provided below for an example of how it can be 
used.

$form->openFieldset("My Fieldset");

//Add some elements inside the fieldset here.

$form->closeFieldset();

Original comment by ajporterfield@gmail.com on 9 Jun 2010 at 4:00

GoogleCodeExporter commented 9 years ago
Hi Andrew,

I'm interested in using the fields set option. I checkout the class.form.php 
from the main truck and over wrote it in my current install, but I find it 
still wraps <div> tags around the form thus breaking it.

Should this be working correctly or am I missing something

$form->openFieldset("My Fieldset");
$form->addHTML("<h2>Personal Details</h2>");
$form->addRadio("Title:", "Personal_title", "", array("option0" => "Mr", 
"option1" => "Mrs", "option2" => "Ms"), array("clear" => 1));
$form->addTextbox("Surname:", "Personal_surname");   
$form->addTextbox("First Names:", "Personal_firstname");
$form->closeFieldset();

Produces 

<div class="pfbc-map pfbc-clear">
<fieldset><legend>My Fieldset</legend>
</div>
<div class="pfbc-map pfbc-clear">
  <div id="pfbc-form_bedshed-element-3" class="pfbc-element pfbc-map-element-first pfbc-map-columns-2">
   <h2>Personal Details</h2>
  </div>
  <div id="pfbc-form_bedshed-element-4" class="pfbc-element pfbc-map-element-last pfbc-map-columns-2">
  <label class="pfbc-label">Title:</label>
  <div class="pfbc-radio pfbc-radio-first"><input type="radio" name="Personal_title" id="Personal_title0" value="option0"/><label for="Personal_title0" style="cursor: pointer;">Mr</label></div>
 <div class="pfbc-radio"><input type="radio" name="Personal_title" id="Personal_title1" value="option1"/><label for="Personal_title1" style="cursor: pointer;">Mrs</label></div>
 <div class="pfbc-radio pfbc-radio-last"><input type="radio" name="Personal_title" id="Personal_title2" value="option2"/><label for="Personal_title2" style="cursor: pointer;">Ms</label></div>
 </div>
 </div>
 <div class="pfbc-map pfbc-clear">
 <div id="pfbc-form_bedshed-element-5" class="pfbc-element pfbc-map-element-first pfbc-map-columns-2">
 <label class="pfbc-label">Surname:</label>
 <input type="text" name="Personal_surname" value="" class="pfbc-textbox"/>
 </div>
 <div id="pfbc-form_bedshed-element-6" class="pfbc-element pfbc-map-element-last pfbc-map-columns-2">
 <label class="pfbc-label">First Names:</label>
 <input type="text" name="Personal_firstname" value="" class="pfbc-textbox"/>
 </div>
 </div>
 <div class="pfbc-map pfbc-clear">
 </fieldset>
 </div>

Original comment by webdewperth@gmail.com on 10 Jun 2010 at 11:18

GoogleCodeExporter commented 9 years ago
You're using it correctly; however, I notice that you're using the mapping 
functionality to structure your form.  Currently, fieldsets only work in 
non-mapping mode.  I'm confident that we will add support for fieldsets in 
mapping mode before the 1.0.7 version release.  I'll keep this thread updated 
on our progress.

- Andrew

Original comment by ajporterfield@gmail.com on 10 Jun 2010 at 1:33

GoogleCodeExporter commented 9 years ago
yes for those who are not reading carefully / paying attention (I did the exact 
same thing) 'maping functionality' does not refer to the google maps ability 
but rather the CSS structureing capability to format the layout. (My excuse is 
I was going off of monocos comment about the 'map thing')

Original comment by eli...@gmail.com on 10 Jun 2010 at 2:02

GoogleCodeExporter commented 9 years ago
elijha,

Thanks for the clarification.  Much appreciated.

- Andrew

Original comment by ajporterfield@gmail.com on 10 Jun 2010 at 2:33

GoogleCodeExporter commented 9 years ago
The latest commit, r234, contains support for fieldsets in mapping mode.  Also 
included is an example file demoing this functionality - 
php-form-builder-class/examples/fieldsets.php.

One thing that I'd like to made note of is that the latest svn working copy is 
in a constants state of change.  Features are added, removed, re-written, etc.  
Using this in a production environment is not recommended.  It should be "used 
at your own risk".  I know this is probably obvious to most all of you; 
however, I thought it best to issue this warning.

Original comment by ajporterfield@gmail.com on 11 Jun 2010 at 4:10

GoogleCodeExporter commented 9 years ago
1.0.7 was released this afternoon and includes fieldset support for both 
non-mapping and mapping mode.  There is a new example file included in the 
download that demos this functionality.

Original comment by ajporterfield@gmail.com on 17 Jun 2010 at 8:03