<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to create an input field without a label</title>
	<atom:link href="http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/feed/" rel="self" type="application/rss+xml" />
	<link>http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/</link>
	<description>baking cakes with CakePHP</description>
	<lastBuildDate>Thu, 11 Mar 2010 15:41:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/comment-page-1/#comment-142928</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Mon, 28 Dec 2009 15:43:42 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/#comment-142928</guid>
		<description>@Axel: You are welcome :)</description>
		<content:encoded><![CDATA[<p>@Axel: You are welcome :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Axel</title>
		<link>http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/comment-page-1/#comment-142766</link>
		<dc:creator>Axel</dc:creator>
		<pubDate>Fri, 25 Dec 2009 16:26:27 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/#comment-142766</guid>
		<description>easy, thank you!</description>
		<content:encoded><![CDATA[<p>easy, thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/comment-page-1/#comment-142549</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Mon, 21 Dec 2009 16:14:44 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/#comment-142549</guid>
		<description>@Krishna: Hm, what did you try to make it red? Did you try it in the way shown below?
&lt;pre&gt;
&lt;code&gt;
.error-message {color: red;}
&lt;/code&gt;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@Krishna: Hm, what did you try to make it red? Did you try it in the way shown below?</p>
<pre>
<code>.error-message {color: red;}</code>
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Krishna</title>
		<link>http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/comment-page-1/#comment-142446</link>
		<dc:creator>Krishna</dc:creator>
		<pubDate>Sat, 19 Dec 2009 14:15:12 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/#comment-142446</guid>
		<description>Thanks for your suggestion. I would appreciate it if you could give a clue about this.
I have been trying to validate form using cakephp. Basically in the model i have validation code like this:
&lt;code&gt;
	var $validate = array(
    	&#039;username&#039;=&gt;array(
    		&#039;rule&#039;=&gt;&#039;alphaNumeric&#039;,
			&#039;required&#039;=&gt;true,
    		&#039;message&#039;=&gt;&#039;Please enter the username&#039;,
    	)
	);
&lt;/code&gt;
and in the view i have this:
&lt;code&gt;
&lt;h2&gt;Add User&lt;/h2&gt;
&lt;?php echo $form-&gt;create(&#039;User&#039;, array(&#039;url&#039; =&gt; &#039;/users/add&#039;));?&gt;
&lt;?php echo $form-&gt;input(&#039;username&#039;, array(&#039;size&#039; =&gt; &#039;20&#039;,&#039;label&#039;=&gt;&#039;User Name:&#039;));?&gt;
&lt;?php
echo &#039;&lt;div&gt;&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; /&gt; or &#039;.$html-&gt;link(&#039;Cancel&#039;, array(&#039;action&#039; =&gt; &#039;index&#039;)).&#039;&lt;/div&gt;&#039;;
echo $form-&gt;end();
?&gt;
&lt;code&gt;
&lt;h2&gt;Add User&lt;/h2&gt;
&lt;?php echo $form-&gt;create(&#039;User&#039;, array(&#039;url&#039; =&gt; &#039;/users/add&#039;));?&gt;
&lt;?php echo $form-&gt;input(&#039;username&#039;, array(&#039;size&#039; =&gt; &#039;20&#039;,&#039;label&#039;=&gt;&#039;User Name:&#039;));?&gt;
&lt;?php
echo &#039;&lt;div&gt;&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; /&gt; or &#039;.$html-&gt;link(&#039;Cancel&#039;, array(&#039;action&#039; =&gt; &#039;index&#039;)).&#039;&lt;/div&gt;&#039;;
echo $form-&gt;end();
?&gt;
&lt;/code&gt;
When I hit submit with empty usename i get the error message &#039;Please enter the username&#039; but it is always black. I was trying to make it red, but could not succeed. I noticed the problem was with class=&#039;required&#039; as seen in the view source:
&lt;code&gt;
&lt;form method=&quot;post&quot; action=&quot;/AuthUsers/users/add&quot;&gt;
&lt;fieldset style=&quot;display:none;&quot;&gt;
&lt;input type=&quot;hidden&quot; name=&quot;_method&quot; value=&quot;POST&quot; /&gt;
&lt;/fieldset&gt;
&lt;div class=&quot;input text required error&quot;&gt;
&lt;label for=&quot;UserUsername&quot;&gt;User Name:&lt;/label&gt;
&lt;input name=&quot;data[User][username]&quot; type=&quot;text&quot; size=&quot;20&quot; maxlength=&quot;20&quot; value=&quot;&quot; id=&quot;UserUsername&quot; class=&quot;form-error&quot; /&gt;
&lt;div class=&quot;error-message&quot;&gt;Please enter the username&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; /&gt; or &lt;a href=&quot;/AuthUsers/users&quot;&gt;Cancel&lt;/a&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/code&gt;

Anny clue as to how i can have the error message displayed in red color but the label in black color?
Krishna</description>
		<content:encoded><![CDATA[<p>Thanks for your suggestion. I would appreciate it if you could give a clue about this.<br />
I have been trying to validate form using cakephp. Basically in the model i have validation code like this:<br />
<pre><code>var $validate = array(
    	'username'=&gt;array(
    		'rule'=&gt;'alphaNumeric',
			'required'=&gt;true,
    		'message'=&gt;'Please enter the username',
    	)
	);</code></pre><br />
and in the view i have this:<br />
<pre><code>&lt;h2&gt;Add User&lt;/h2&gt;
&lt;?php echo $form-&gt;create('User', array('url' =&gt; '/users/add'));?&gt;
&lt;?php echo $form-&gt;input('username', array('size' =&gt; '20','label'=&gt;'User Name:'));?&gt;
&lt;?php
echo '&lt;div&gt;&lt;input type="submit" value="Submit" /&gt; or '.$html-&gt;link('Cancel', array('action' =&gt; 'index')).'&lt;/div&gt;';
echo $form-&gt;end();
?&gt;
&lt;code&gt;
&lt;h2&gt;Add User&lt;/h2&gt;
&lt;?php echo $form-&gt;create('User', array('url' =&gt; '/users/add'));?&gt;
&lt;?php echo $form-&gt;input('username', array('size' =&gt; '20','label'=&gt;'User Name:'));?&gt;
&lt;?php
echo '&lt;div&gt;&lt;input type="submit" value="Submit" /&gt; or '.$html-&gt;link('Cancel', array('action' =&gt; 'index')).'&lt;/div&gt;';
echo $form-&gt;end();
?&gt;</code></pre><br />
When I hit submit with empty usename i get the error message &#8216;Please enter the username&#8217; but it is always black. I was trying to make it red, but could not succeed. I noticed the problem was with class=&#8217;required&#8217; as seen in the view source:<br />
<pre><code>&lt;form method="post" action="/AuthUsers/users/add"&gt;
&lt;fieldset style="display:none;"&gt;
&lt;input type="hidden" name="_method" value="POST" /&gt;
&lt;/fieldset&gt;
&lt;div class="input text required error"&gt;
&lt;label for="UserUsername"&gt;User Name:&lt;/label&gt;
&lt;input name="data[User][username]" type="text" size="20" maxlength="20" value="" id="UserUsername" class="form-error" /&gt;
&lt;div class="error-message"&gt;Please enter the username&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;input type="submit" value="Submit" /&gt; or &lt;a href="/AuthUsers/users"&gt;Cancel&lt;/a&gt;
&lt;/div&gt;
&lt;/form&gt;</code></pre>
<p>Anny clue as to how i can have the error message displayed in red color but the label in black color?<br />
Krishna</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/comment-page-1/#comment-92374</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Mon, 02 Jun 2008 14:46:18 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/#comment-92374</guid>
		<description>@Jon: Thanks for your explanation, now it is clear what you meant. I hope I can fix it.

Anyway, good luck on your journey :)</description>
		<content:encoded><![CDATA[<p>@Jon: Thanks for your explanation, now it is clear what you meant. I hope I can fix it.</p>
<p>Anyway, good luck on your journey :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/comment-page-1/#comment-91862</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Fri, 30 May 2008 17:12:23 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/#comment-91862</guid>
		<description>@cakebaker: Thanks for your suggestions.

re: post back - I wrote out a whole comment, about as long as the last one, but when I submitted, I forgot the mand. fields.  I got a message saying to fill the mand. fields, but the message just stayed there (it was the only thing on the screen) and I wasn&#039;t redirected back to my post.  I clicked back button and my writing was gone and I had to re-write.  

Thanks again for your responses and your blog.  It&#039;s an excellent resource for someone like me who&#039;s beginning what seems to be a long journey in php programming, and the cake framework.</description>
		<content:encoded><![CDATA[<p>@cakebaker: Thanks for your suggestions.</p>
<p>re: post back &#8211; I wrote out a whole comment, about as long as the last one, but when I submitted, I forgot the mand. fields.  I got a message saying to fill the mand. fields, but the message just stayed there (it was the only thing on the screen) and I wasn&#8217;t redirected back to my post.  I clicked back button and my writing was gone and I had to re-write.  </p>
<p>Thanks again for your responses and your blog.  It&#8217;s an excellent resource for someone like me who&#8217;s beginning what seems to be a long journey in php programming, and the cake framework.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/comment-page-1/#comment-91856</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Fri, 30 May 2008 15:53:59 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/#comment-91856</guid>
		<description>@Jon: I&#039;m not aware of such an alias function. Maybe it is worth to open an enhancement ticket for Inflector::underscore() to make it more sophisticated. But I&#039;m not sure whether this will get implemented, so I think it is probably easier to write a custom helper, which internally calls the FormHelper in the way shown in my previous comment.

Regarding configuration model, I would probably create a model for each configuration table, and then have a special configurations controller. But at first I would ask myself whether this additional complexity is really necessary and worth the effort.

What do you mean with &quot;post back method&quot;?</description>
		<content:encoded><![CDATA[<p>@Jon: I&#8217;m not aware of such an alias function. Maybe it is worth to open an enhancement ticket for Inflector::underscore() to make it more sophisticated. But I&#8217;m not sure whether this will get implemented, so I think it is probably easier to write a custom helper, which internally calls the FormHelper in the way shown in my previous comment.</p>
<p>Regarding configuration model, I would probably create a model for each configuration table, and then have a special configurations controller. But at first I would ask myself whether this additional complexity is really necessary and worth the effort.</p>
<p>What do you mean with &#8220;post back method&#8221;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/comment-page-1/#comment-91758</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Thu, 29 May 2008 22:30:55 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/#comment-91758</guid>
		<description>@cakebaker: thanks for the reply.  I came to the same conclusion as the one you suggested... unfortunately.

Is there a suggested naming conventions for fields that have acronyms (the system uses a lot of techish fields (IP, DLCI, TCP, etc) but I&#039;d like to not have to override all the names.  perhaps theres a built in alias function in cake?

I&#039;m trying to get away from building static views. I&#039;d like to be able to build the form according to the db schema, possibly with a few alterations (order of the fields).  On that note, do you have any ideas of a configuration model to have a bunch of user configuration tables to control things like :
- drop downs (what fields to use them on, what options to allow, and the order of the options)
- fields to include in reports, forms, tables, etc. (what fields to omit in forms, or reports, but still include in a different table) 

if this doesn&#039;t make sense, it may be a result of me having to write it again since i didn&#039;t include my name and email in the original post (p.s. you should have some sorta post back method).  

i built a web app that i&#039;m now trying to migrate into the cake framework but a combo of me being a bit of a noob (only a year of self taught programming) and the spotty documentation is making it tougher than i first anticipated.  any help you can offer would be swell.</description>
		<content:encoded><![CDATA[<p>@cakebaker: thanks for the reply.  I came to the same conclusion as the one you suggested&#8230; unfortunately.</p>
<p>Is there a suggested naming conventions for fields that have acronyms (the system uses a lot of techish fields (IP, DLCI, TCP, etc) but I&#8217;d like to not have to override all the names.  perhaps theres a built in alias function in cake?</p>
<p>I&#8217;m trying to get away from building static views. I&#8217;d like to be able to build the form according to the db schema, possibly with a few alterations (order of the fields).  On that note, do you have any ideas of a configuration model to have a bunch of user configuration tables to control things like :<br />
- drop downs (what fields to use them on, what options to allow, and the order of the options)<br />
- fields to include in reports, forms, tables, etc. (what fields to omit in forms, or reports, but still include in a different table) </p>
<p>if this doesn&#8217;t make sense, it may be a result of me having to write it again since i didn&#8217;t include my name and email in the original post (p.s. you should have some sorta post back method).  </p>
<p>i built a web app that i&#8217;m now trying to migrate into the cake framework but a combo of me being a bit of a noob (only a year of self taught programming) and the spotty documentation is making it tougher than i first anticipated.  any help you can offer would be swell.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/comment-page-1/#comment-91722</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Thu, 29 May 2008 15:00:59 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/#comment-91722</guid>
		<description>@Jon: Thanks for your comment!

I think you could write your own helper which extends the FormHelper, and then override the label() method. But it is a bit an ugly solution. It is probably easier if you provide an explicit value for the label with:
&lt;pre&gt;
$form-&gt;input(&#039;MyModel.DLCI1&#039;, array(&#039;label&#039; =&gt; &#039;DLCI1&#039;));
&lt;/pre&gt;

Hope that helps!</description>
		<content:encoded><![CDATA[<p>@Jon: Thanks for your comment!</p>
<p>I think you could write your own helper which extends the FormHelper, and then override the label() method. But it is a bit an ugly solution. It is probably easier if you provide an explicit value for the label with:</p>
<pre>
$form-&gt;input('MyModel.DLCI1', array('label' =&gt; 'DLCI1'));
</pre>
<p>Hope that helps!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/comment-page-1/#comment-91562</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Wed, 28 May 2008 04:09:46 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/03/01/how-to-create-an-input-field-without-a-label/#comment-91562</guid>
		<description>Thanks for this, your site here has been a huge use to me in the last week.  I&#039;m just learning and starting off on 1.2... the documentation is weak.
they say $form-&gt;input has 2 arguments, the second being $options, but they don&#039;t tell you what options you can use...

do you know if theres a way to override cakes method of splitting up field names at the case? I.e. I have a set of field names DLCI[1-7].  When the $form-&gt;input helper does its thing, it makes the label D L C I1 and so on...</description>
		<content:encoded><![CDATA[<p>Thanks for this, your site here has been a huge use to me in the last week.  I&#8217;m just learning and starting off on 1.2&#8230; the documentation is weak.<br />
they say $form-&gt;input has 2 arguments, the second being $options, but they don&#8217;t tell you what options you can use&#8230;</p>
<p>do you know if theres a way to override cakes method of splitting up field names at the case? I.e. I have a set of field names DLCI[1-7].  When the $form-&gt;input helper does its thing, it makes the label D L C I1 and so on&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
