<?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: Place Holding Text In Form Inputs</title>
	<atom:link href="http://blackwidows.co.uk/blog/2005/07/20/place-holding-text-in-form-inputs/feed/" rel="self" type="application/rss+xml" />
	<link>http://blackwidows.co.uk/blog/2005/07/20/place-holding-text-in-form-inputs/</link>
	<description>The meanderings of a black widow...</description>
	<pubDate>Tue, 06 Jan 2009 12:30:13 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: David Anderson</title>
		<link>http://blackwidows.co.uk/blog/2005/07/20/place-holding-text-in-form-inputs/comment-page-1/#comment-544</link>
		<dc:creator>David Anderson</dc:creator>
		<pubDate>Fri, 19 Aug 2005 20:25:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.blackwidows.co.uk/blog/?p=34#comment-544</guid>
		<description>err... silly html error. like this:

if (strlen(trim($formdata)) &lt; 1) then user left the field empty</description>
		<content:encoded><![CDATA[<p>err&#8230; silly html error. like this:</p>
<p>if (strlen(trim($formdata)) < 1) then user left the field empty</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Anderson</title>
		<link>http://blackwidows.co.uk/blog/2005/07/20/place-holding-text-in-form-inputs/comment-page-1/#comment-543</link>
		<dc:creator>David Anderson</dc:creator>
		<pubDate>Fri, 19 Aug 2005 20:24:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.blackwidows.co.uk/blog/?p=34#comment-543</guid>
		<description>If you can edit the code that processes the submitted form data, all you need is something along these lines:
if(strlen(trim($formdata)) </description>
		<content:encoded><![CDATA[<p>If you can edit the code that processes the submitted form data, all you need is something along these lines:<br />
if(strlen(trim($formdata))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Administrator</title>
		<link>http://blackwidows.co.uk/blog/2005/07/20/place-holding-text-in-form-inputs/comment-page-1/#comment-538</link>
		<dc:creator>Administrator</dc:creator>
		<pubDate>Fri, 19 Aug 2005 09:15:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.blackwidows.co.uk/blog/?p=34#comment-538</guid>
		<description>Carry out a specific check on the required input. If the input equals null or your default text, display an error message to the user and direct them back to the form again.

I tend to use something like:

&lt;code&gt;/* Check that a required input has been submitted
$text = the user's input
$default = your placeholding text
$msg = the error message you want displayed to the user
&lt;/code&gt;

Call the function using:

&lt;code&gt;list($flag, $display) = checkField($text, &#34;Please enter your comments&#34;, &#34;You left the Comments field blank!&#34;);
	if($flag==false) echo $display;&lt;/code&gt;

&lt;code&gt;function checkField($text,$default,$msg)
{
	$result = array();
	// Has something been submitted?
	if(($text=="") &#124; ($text == $default))
	{
		$result[0]=false;
		$result[1]="".$msg."";
		return $result;
	}
	else 
	{
		$result[0] = true;
		return $result;
	}
}&lt;/code&gt;
</description>
		<content:encoded><![CDATA[<p>Carry out a specific check on the required input. If the input equals null or your default text, display an error message to the user and direct them back to the form again.</p>
<p>I tend to use something like:</p>
<p><code>/* Check that a required input has been submitted<br />
$text = the user's input<br />
$default = your placeholding text<br />
$msg = the error message you want displayed to the user<br />
</code></p>
<p>Call the function using:</p>
<p><code>list($flag, $display) = checkField($text, &quot;Please enter your comments&quot;, &quot;You left the Comments field blank!&quot;);<br />
	if($flag==false) echo $display;</code></p>
<p><code>function checkField($text,$default,$msg)<br />
{<br />
	$result = array();<br />
	// Has something been submitted?<br />
	if(($text=="") | ($text == $default))<br />
	{<br />
		$result[0]=false;<br />
		$result[1]=&#8221;".$msg.&#8221;";<br />
		return $result;<br />
	}<br />
	else<br />
	{<br />
		$result[0] = true;<br />
		return $result;<br />
	}<br />
}</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lisa Alaxanian</title>
		<link>http://blackwidows.co.uk/blog/2005/07/20/place-holding-text-in-form-inputs/comment-page-1/#comment-534</link>
		<dc:creator>Lisa Alaxanian</dc:creator>
		<pubDate>Thu, 18 Aug 2005 14:45:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.blackwidows.co.uk/blog/?p=34#comment-534</guid>
		<description>I am trying to create a form where textareas are 'required' by the user but if I include defaulted text within the box (W3C Priority 3 accessibility guideline) or as noted by Rich Pedley, include a white space, the 'required' part will no longer work, which means the user can just select 'submit' and I won't get the information I need from them.  

Any suggestions?

Thanks - Lisa</description>
		<content:encoded><![CDATA[<p>I am trying to create a form where textareas are &#8216;required&#8217; by the user but if I include defaulted text within the box (<acronym title="World Wide Web Consortium">W3C</acronym> Priority 3 accessibility guideline) or as noted by Rich Pedley, include a white space, the &#8216;required&#8217; part will no longer work, which means the user can just select &#8217;submit&#8217; and I won&#8217;t get the information I need from them.  </p>
<p>Any suggestions?</p>
<p>Thanks - Lisa</p>
]]></content:encoded>
	</item>
</channel>
</rss>
