PHP Classes

Date input label

Recommend this page to a friend!

      PHP Forms Class with HTML Generator and JavaScript Validation  >  PHP Forms Class with HTML Generator and JavaScript Validation package blog  >  How to Show Google Ma...  >  All threads  >  Date input label  >  (Un) Subscribe thread alerts  
Subject:Date input label
Summary:Urgent help with date label
Messages:9
Author:ffff
Date:2007-07-06 15:58:54
Update:2007-07-07 05:38:12
 

  1. Date input label   Reply   Report abuse  
Picture of ffff ffff - 2007-07-06 15:58:54
Hello,

I am using the automatic vertical layout plug-in. When I try to add an Input of the type "date input," the LABEL property is not displayed like with all the other input types.

I have specified in the vertical layout:
var $input_format = "<li>{label} &nbsp{input}&nbsp;<span id=\"mark_{id}\">{mark}</span></li>\n";

But the label part never appears in the page. What I need is to make the date input to display its label using the format:

"<li>{label}... {input} ...</li>"

BUT, when the form is in read only mode, I want to display it without the <li> tags, like this:

"{label}... (input value read-only) ..."

With all the other types of inputs, the class does all this automatically, but not with the date inputs.

Please help!


  2. Re: Date input label   Reply   Report abuse  
Picture of ffff ffff - 2007-07-06 16:18:28 - In reply to message 1 from ffff
Ignore what I said about the <li> tags. I have checked the code in the other input type fields and the thing that must change in the readonly mode is the <label for=""> tag.

In the normal mode the form should output:

<label for="date">Date: </label> **data here**

And in the read only mode it should output:
Date: **read only data here**


This is the normal behavior of any other input field. But it does not work with the date input because the label part never appears. I need the label part in the same position as all the other inputs.

How can I achieve this?




  3. Re: Date input label   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-07-06 21:31:41 - In reply to message 2 from ffff
I tried adding a date custom input to the test_smarty_form.php example and it worked as expected. The input shows the label and date inputs and values correctly either in normal mode and read-only mode.

How you are defining your date input?

  4. Re: Date input label   Reply   Report abuse  
Picture of ffff ffff - 2007-07-06 21:55:18 - In reply to message 3 from Manuel Lemos
I am not using smarty...

I am defining the date input value like this:


$form->AddInput(array(
"TYPE"=>"custom",
"ID"=>"workDate",
"LABEL"=>"Enter Date:",
"CustomClass"=>"form_date_class",
"Format"=>"{day}/{month}/{year}",
"Months"=>array(
"01"=>"Enero",
"02"=>"Febrero",
"03"=>"Marzo",
"04"=>"Abril",
"05"=>"Mayo",
"06"=>"Junio",
"07"=>"Julio",
"08"=>"Augosto",
"09"=>"Septiembre",
"10"=>"Octubre",
"11"=>"Noviembre",
"12"=>"Diciembre"
),
"Optional"=>0

));


Then I define the input in the

$form->AddInput(array(
'Inputs'=>array( ...


Doing this the dropdown menus of the date shows in the page, but the LABEL "Enter Date:" does not show.


  5. Re: Date input label   Reply   Report abuse  
Picture of ffff ffff - 2007-07-06 22:01:20 - In reply to message 3 from Manuel Lemos
Try adding the a date input in the "test_auto_layout_form.php" page and you'll see what I mean. No label appears...

  6. Re: Date input label   Reply   Report abuse  
Picture of ffff ffff - 2007-07-07 02:49:02 - In reply to message 5 from ffff
After many hours of debugging I finally solved my problem!

What I did is define in the:

$form->AddInput(
'Properties'=>array(
'Date'=>array(
'InputFormat'=> <li>{label} &nbsp{input}&nbsp;<span id=\"mark_{id}\">{mark}</span></li>'), ...

I do not know why did I have to REDEFINE the input format for the date input because it was already defined in the form_layout_vertical.php page:

var $input_format = "<li>{label} &nbsp{input}&nbsp;<span id=\"mark_{id}\">{mark}</span></li>\n";

But at least it is working now :)





  7. Re: Date input label   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-07-07 03:51:05 - In reply to message 5 from ffff
Oh, sorry, I thought you meant you were using Smarty templates.

I found the problem. Custom inputs were not returning the LABEL attribute properly, so the vertical layout input was assuming the data input had no label. That makes it use separate template for inputs without labels, like standalone submit inputs.

Anyway, the bug was fixed. For now you may download the fixed version from the Web interface to the forms class CVS repository here:

meta-language.net/cvs/~checkout~/fo ...

  8. Re: Date input label   Reply   Report abuse  
Picture of ffff ffff - 2007-07-07 04:11:24 - In reply to message 7 from Manuel Lemos
Wow, that is what I call fast support. I am glad all this helped to find a bug ;)

Great work with your class. The only thing I had trouble is with the documentation videos the volume is very soft. I can barely hear it.

  9. Re: Date input label   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-07-07 05:38:12 - In reply to message 8 from ffff
Yes, unfortunately I only realized the volume was too low after I have authored and uploaded the whole video. It took a lot of time to do everything. Maybe if I have more time later, I will update the video and take care of those details that did not came out right in the current video.