Form element with multiple text areas

I have been racking my brain on how to create a form element with multiple text areas and one database entry.  I created a section for users to input their work hours.  It works but I know it is a 100% wrong as I had to create a separate text area for each element. (I have also looked through the Forms 8 page on here.)

For Example:

On Sunday I would need a text area for the "from" time and a "to" time.  If you do the math that is 14 text areas for each day and 14 database entries in the 'Profiles' database.

My question to the boonex geniuses here is how to I create something as simple as a Hours Block for my users using one database entry and less than 14 form elements (preferably one) in the edit profile area.

My goal format for the edit profile area is:

Sunday    From "Text Area"  To "Text Area"

Monday    From "Text Area"  To "Text Area"

etc...

 

Please see attachments for what I have now.

database.png · 44.5K · 140 views
hours.png · 92.4K · 136 views
edit-hours.png · 364.1K · 133 views
Quote · 21 Feb 2014

First of all, the title was misleading because the input boxes are just text inputs, not text areas.

Now, the question is that if you are just storing these as text, and not trying to store it as time, then you simply catenate the two input fields before storing them. $Sunday = $SunFrom . $SunTo; and you can add text; $Sunday = $SunFrom . ' - ' . $SunTo;  The dot is the catenate for php.  Then you store the $Sunday in the Sunday column in the database.

For the layout, you would want the label and then the From and To input fields side by side but the way you have them works as well.

Geeks, making the world a better place
Quote · 21 Feb 2014

A quick and dirty way to layout the form is to use tables; it is used by Dolphin and it is used by many sites around the net.  Is it a valid use of a table?  Eh, could be debated I guess but it is in general use.

Geeks, making the world a better place
Quote · 21 Feb 2014

I still use tables myself. Whenever it is easier to use tables rather than css then i do.

CSS still cannot properly handle things as easily as a table can with some things. Such as columnizing results, vertical centering of text. Sorry. But i am one of the ones who believes a table currently cannot be replaced adequately with CSS.

https://www.deanbassett.com
Quote · 21 Feb 2014

 

table currently cannot be replaced adequately with CSS.

 well it can be using display properties but unless you really hate "table" tag in your html it makes no sense ;)

so much to do....
Quote · 21 Feb 2014

Thanks for the reply and sorry for the misleading text.  So the issue was that i was using the admin backend for editing profile and adding new items rather than adding the elements to the pedit.php. It never occurred to me to edit the pedit.php file. Thanks for the help.  I will reply back with the results if anyone else is interested.

Quote · 21 Feb 2014

OK, unclear of what you were trying to do.  I thought you were building a custom form.  If you are trying to do this with the profile fields, then that is a bit different.

First, you would create a section, Work Hours.  So you want to have a quick way for them to enter a from and to time for each day of the week using the profile builder and have that stored in a single field.  I would have to give this some thought, maybe others can tell you a way to handle it using the profile builder.

Geeks, making the world a better place
Quote · 21 Feb 2014

This really does need to be a custom form in order to do what you want to do.

Instead of input boxes, I would use select boxes and have the list populated with the times; bit of extra work but you control the input from the users better; if they are starting on the hour.

6:00 AM

7:00 AM

8:00 AM

and so on.  Then they select the From time from the predefined list.

Geeks, making the world a better place
Quote · 21 Feb 2014

Yea the built in form builders cannot do complex forms. So yea, it will have to be done by hand.

https://www.deanbassett.com
Quote · 21 Feb 2014

Ok so I have come to the conclusion that I will stick with my current format of 14 db entries and 14 inputs.  It works exactly how I want it to it just isnt compact.  Ill just have to deal with it rather than doing major surgery just for that one form.

 

Thanks for the assistance all.

Quote · 21 Feb 2014
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.