<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>RubberNeck Designs &#187; Web Design</title>
	<atom:link href="http://www.rubberneckdesigns.com/category/web-design/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rubberneckdesigns.com</link>
	<description>Drupal Web Developer Notes &#38; Sharing</description>
	<lastBuildDate>Tue, 31 Jan 2012 00:28:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>HTML5: How to Make a datalist for a Form Field Input Element</title>
		<link>http://www.rubberneckdesigns.com/usability/html5-how-to-make-a-datalist-for-a-form-field-input-element/</link>
		<comments>http://www.rubberneckdesigns.com/usability/html5-how-to-make-a-datalist-for-a-form-field-input-element/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 18:16:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[User Iterface Design]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=544</guid>
		<description><![CDATA[Isn’t it nice when web developers make it easy for end users to fill out a form? One way to make for a pleasant user experience is to offer suggestions on a form’s input field. HTML5 now has a cool feature that makes this easier for the developers too! The HTML5 datalist element provides an [...]]]></description>
			<content:encoded><![CDATA[<p>Isn’t it nice when web developers make it easy for end users to fill out a form? One way to make for a pleasant user experience is to offer suggestions on a form’s input field. HTML5 now has a cool feature that makes this easier for the developers too!</p>
<p>The HTML5 datalist element provides an &#8220;autocomplete&#8221; feature on form elements.  With it, you can provide a list of predefined options to the user as they input data.</p>
<p>Now, when a user is entering some text into a text field, a list can drop down with pre-filled values for them to choose from.</p>
<p><strong>How to Make a datalist for a Form Field Input Element</strong><br />
The datalist tag was introduced in HTML 5.</p>
<p>Use the ID of the datalist tag to associate it with the appropriate input.<br />
For example, if the datalist tag has an id=&#8221;myDataList&#8221;, then the list attribute of the input element will look like this: list=&#8221;myDataList&#8221;.</p>
<p>You can fill the datalist element by nesting option tags inside the datalist tag. Here is an example of the code for the HTML5 datalist element:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
</pre></td><td class="code"><pre class="html5" style="font-family:monospace;">&lt;p&gt;
&lt;label&gt;
  Enter your favorite Star Trek character:&lt;br /&gt;
&lt;input type=&quot;text&quot; name=&quot;favCharacter&quot; list=&quot;myDataList&quot;&gt;
&lt;datalist id=&quot;myDataList&quot;&gt;
 &lt;option value=&quot;Captain Kirk&quot;&gt;
 &lt;option value=&quot;Spock&quot;&gt;
 &lt;option value=&quot;Bones&quot;&gt;
 &lt;option value=&quot;Scotty&quot;&gt;
 &lt;option value=&quot;Sulu&quot;&gt;
 &lt;option value=&quot;Chekov&quot;&gt;
 &lt;option value=&quot;Uhura&quot;&gt;
 &lt;option value=&quot;Jean-Luc Picard&quot;&gt;
 &lt;option value=&quot;Data&quot;&gt;
 &lt;option value=&quot;Geordi La Forge&quot;&gt;
 &lt;option value=&quot;Worf&quot;&gt;
&lt;/datalist&gt;
&lt;/label&gt;
&lt;/p&gt;</pre></td></tr></table></div>

<p>
<label><br />
  Enter your favorite Star Trek character:</p>
<input type="text" name="favCharacter" list="myDataList">
<datalist id="myDataList"></p>
<option value="Captain Kirk">
<option value="Spock">
<option value="Bones">
<option value="Scotty">
<option value="Sulu">
<option value="Chekov">
<option value="Uhura">
<option value="Jean-Luc Picard">
<option value="Data">
<option value="Geordi La Forge">
<option value="Worf">
</datalist><br />
</label>
</p>
<p>OK, so now you know. Go be nice to your users with the HTML5 <datalist> tag!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/usability/html5-how-to-make-a-datalist-for-a-form-field-input-element/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git: Understanding how to use GIT</title>
		<link>http://www.rubberneckdesigns.com/web-design/git-understanding-how-to-use-git/</link>
		<comments>http://www.rubberneckdesigns.com/web-design/git-understanding-how-to-use-git/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 22:18:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=537</guid>
		<description><![CDATA[An excellent read about GIT and how to use it: &#8220;A successful Git branching model&#8221; on a blog named nvie.com maintained by Vincent Driessen Great article, Vincent, thanks!]]></description>
			<content:encoded><![CDATA[<p>An excellent read about GIT and how to use it: &#8220;<a href="http://nvie.com/posts/a-successful-git-branching-model/" title="A successful Git branching model">A successful Git branching model</a>&#8221; on a blog named nvie.com maintained by Vincent Driessen<br />
<img alt="How to use GIT" src="http://nvie.com/img/2009/12/Screen-shot-2009-12-24-at-11.32.03.png" title="Git" class="aligncenter" width="611" height="815" /><br />
Great article, Vincent, thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/web-design/git-understanding-how-to-use-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS3: Drop Shadow on an Image</title>
		<link>http://www.rubberneckdesigns.com/css/css3-drop-shadow-on-an-image/</link>
		<comments>http://www.rubberneckdesigns.com/css/css3-drop-shadow-on-an-image/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 23:27:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=526</guid>
		<description><![CDATA[Drop shadows are a nice way to add dimension to a site. Creating them used to be a real task. Combining multiple divs and floats and trickery with CSS that were basically hacks. Not to mention how difficult it was to accomplish creating shadows programmaticlly. Well, making a drop shadow on an image is easy [...]]]></description>
			<content:encoded><![CDATA[<p>Drop shadows are a nice way to add dimension to a site. Creating them used to be a real task. Combining multiple divs and floats and trickery with CSS that were basically hacks. Not to mention how difficult it was to accomplish creating shadows programmaticlly. Well, making a drop shadow on an image is easy now thanks to CSS3!</p>
<p>Enter the box-shadow element! The box-shadow element is supported in IE9+, Firefox 4, Chrome, Opera, and Safari 5.1.1. The syntax of the box-shadow CSS3 element is as follows:</p>
<p><em>box-shadow: h-shadow v-shadow blur spread color inset;</em></p>
<p>The box-shadow element is a comma separated list of properties that effect the position and size and color and even the opacity of the shadow. Note the inset perimeter. That controls wether the shadow is inside of or outside of the object getting the shadow.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>23
24
25
26
27
28
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&nbsp;
<span style="color: #6666ff;">.image-framer</span> img <span style="color: #00AA00;">&#123;</span>
border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span> <span style="color: #933;">5px</span> <span style="color: #933;">5px</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
<span style="color: #808080; font-style: italic;">/* box-shadow: h-shadow v-shadow blur spread color inset;*/</span>
box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span>  <span style="color: #933;">3px</span> <span style="color: #933;">5px</span> <span style="color: #cc66cc;">0</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0.5</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p><a href="http://www.rubberneckdesigns.com/wp-content/uploads/2012/01/Screen-shot-2012-01-04-at-5.20.08-PM1.png"><img src="http://www.rubberneckdesigns.com/wp-content/uploads/2012/01/Screen-shot-2012-01-04-at-5.20.08-PM1.png" alt="CSS3 image drop shadwo" title="CSS3 image drop shadwo" width="245" height="153" class="alignnone size-full wp-image-530" /></a></p>
<p>The first to parameters control the horizontal and vertical position of the shadow.</p>
<p>Next is the optional blur distance measure followed by the optional spread (or size) of the shadow.</p>
<p>The next paramiter is the color parameter. Here is where you can use the new CSS3 rgba(0, 0, 0, 0.5) element. With the rgba(0, 0, 0, 0.5) element you can control the opacity as well. Or you could use the color number here if you like without opacity.</p>
<p>OK, well, enough talk. Go try it out!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/css/css3-drop-shadow-on-an-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal: Load a Function Based on URL (wildcard loaders)</title>
		<link>http://www.rubberneckdesigns.com/web-design/drupal-load-a-function-based-on-url-wildcard-loaders/</link>
		<comments>http://www.rubberneckdesigns.com/web-design/drupal-load-a-function-based-on-url-wildcard-loaders/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 15:10:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=519</guid>
		<description><![CDATA[Drupal sites often use wildcards in their URL. In Drupal, this is accomplished in the hook_menu() function. In the hook_menu() function, the URL is defined as the key of the $item array. The wildcard value is represented by the token, % (percent sign). But did you know the % can proceed the name of a [...]]]></description>
			<content:encoded><![CDATA[<p>Drupal sites often use wildcards in their URL. In Drupal, this is accomplished in the hook_menu() function. In the hook_menu() function, the URL is defined as the key of the $item array. The wildcard value is represented by the token, % (percent sign). But did you know the % can proceed the name of a callback function? Drupal automatically &#8220;knows&#8221; to look for the callback function you call out. There is a bit of a trick to it, though. Note in the example that there is &#8216;my_function&#8217;  immediately after the wildcard (%). That would be the call to the callback function. The little trickiness is that you need to define the function in your module suffixed with the word &#8216;_load&#8217;.  The function you define as my_function_load( $nid ), also needs to have an argument of $nid. Pretty easy, huh? Drupal will &#8220;know&#8221; that the wildcard (%) is a token representing the parameter ($nid) for the function.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
  <span style="color: #339933;">...</span> some code <span style="color: #339933;">...</span>
	<span style="color: #000088;">$items</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'node/%my_function/someplace'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'My Ttitle'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'page callback'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'mymodule_page'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'page arguments'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #339933;">...</span> some code <span style="color: #339933;">...</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Menu loader callback. Load a webform node if the given nid is a webform.
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> my_function_load<span style="color: #009900;">&#40;</span><span style="color: #000088;">$nid</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #339933;">....</span> <span style="color: #b1b100;">do</span> some stuff here <span style="color: #339933;">...</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$node</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/web-design/drupal-load-a-function-based-on-url-wildcard-loaders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Access the Database from hook_form_submit() Function</title>
		<link>http://www.rubberneckdesigns.com/drupal-6-drupal-7/how-to-access-the-database-from-hook_form_submit-function/</link>
		<comments>http://www.rubberneckdesigns.com/drupal-6-drupal-7/how-to-access-the-database-from-hook_form_submit-function/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 14:28:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal 6 & Drupal 7]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=412</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/drupal-6-drupal-7/how-to-access-the-database-from-hook_form_submit-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get The Calling Function</title>
		<link>http://www.rubberneckdesigns.com/ajax-web-design/get-the-calling-function/</link>
		<comments>http://www.rubberneckdesigns.com/ajax-web-design/get-the-calling-function/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 13:44:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Drupal 6 & Drupal 7]]></category>
		<category><![CDATA[MAMP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=481</guid>
		<description><![CDATA[Knowing which PHP function call the code we are working on can give us the clues we need for de-bugging a script. Getting the calling function is easy in PHP, thanks to the debug_backtrace() function. Just put the following code wherever in your script you need to know what function is calling the part you [...]]]></description>
			<content:encoded><![CDATA[<p>Knowing which PHP function call the code we are working on can give us the clues we need for de-bugging a script.<br />
 Getting the calling function is easy in PHP, thanks to the <a href="http://php.net/manual/en/function.debug-backtrace.php">debug_backtrace() function</a>. </p>
<p>Just put the following code wherever in your script you need to know what function is calling the part you are working on.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>45
46
47
48
49
50
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>php<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000088;">$backtrace</span> <span style="color: #339933;">=</span> <span style="color: #990000;">debug_backtrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;The function that just called this code is &lt;strong&gt;&quot;</span> <span style="color: #339933;">.</span><span style="color: #000088;">$backtrace</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'function'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;strong&gt;.&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #339933;">&lt;/</span>php<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>This will output something like this:</p>
<blockquote><p>The function that just called this code is <strong>DrawWidget</strong>.</p></blockquote>
<p>Where <strong>DrawWidget</strong> is the name of the function.</p>
<p>I hope this comes in handy for someone. Thanks for visiting!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/ajax-web-design/get-the-calling-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal Security Best Practices When Outputting Text Into HTML</title>
		<link>http://www.rubberneckdesigns.com/drupal-6-drupal-7/drupal-security-best-practices-when-outputting-text-into-html/</link>
		<comments>http://www.rubberneckdesigns.com/drupal-6-drupal-7/drupal-security-best-practices-when-outputting-text-into-html/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 23:13:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal 6 & Drupal 7]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Security]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=505</guid>
		<description><![CDATA[When creating a module in Drupal it is very important to be aware of some security best practices when outputting text into HTML. This helps prevent XSS (Cross Site Scripting) exploits and keeps your code in general good health as it prevents problems with user input like angle brackets or ampersands. Be sure to read [...]]]></description>
			<content:encoded><![CDATA[<p>When creating a module in Drupal it is very important to be aware of some security best practices when outputting text into HTML. This helps prevent XSS (Cross Site Scripting) exploits and keeps your code in general good health as it prevents problems with user input like angle brackets or ampersands. </p>
<p>Be sure to read the documentation for db_query() on how to use the database API securely.</p>
<p>When passing plain-text from the user to HTML markup, you need to pass it through the check_plain() function first. Drupal’s check_plain() converts quotes, ampersands and angle brackets into entities. This causes the string to be shown in a literal way on the browser screen.</p>
<p>There are a few themeable functions that automatically sanitize text by first passing it through check_plain(). They are: t() , menu items and breadcrumbs, Block descriptions (‘but not titles’), theme(&#8216; plain-text placeholder&#8217;), theme_username() and Drupal Form API #default_value element and #options element when the type is a select box.</p>
<p>Examples:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>php<span style="color: #339933;">&gt;</span>
        <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'safe_way'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
          <span style="color: #0000ff;">'#type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'textfield'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'#default_value'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$user_supplied</span><span style="color: #339933;">,</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'not_safe_way'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
          <span style="color: #0000ff;">'#type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'select'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'#default_value'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">//FORM API will pass this through </span>
                                 <span style="color: #666666; font-style: italic;">//check_plain(),</span>
          <span style="color: #0000ff;">'#options'</span> <span style="color: #339933;">=&gt;</span> node_get_types<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'names'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>  <span style="color: #666666; font-style: italic;">// DANGER: FORM </span>
                                 <span style="color: #666666; font-style: italic;">// API will NOT sanitize the  </span>
                                 <span style="color: #666666; font-style: italic;">// '#options' attribute with </span>
                                 <span style="color: #666666; font-style: italic;">// check_plain().</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>As a Drupal module developer, it is important to commit to memory some common places where sanitizing plain text is important.</p>
<p>Setting the page title:<br />
 Examples:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>php<span style="color: #339933;">&gt;</span>
&nbsp;
        drupal_set_title<span style="color: #009900;">&#40;</span><span style="color: #000088;">$node</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//BAD, XSS vulnerability</span>
        drupal_set_title<span style="color: #009900;">&#40;</span>check_plain<span style="color: #009900;">&#40;</span><span style="color: #000088;">$node</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">// Correct way</span>
        <span style="color: #666666; font-style: italic;">//NOTE: The same applies to block titles that are </span>
        <span style="color: #666666; font-style: italic;">//      passed through hook_block().</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p> Form elements #description and #title<br />
 Examples:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>php<span style="color: #339933;">&gt;</span>
&nbsp;
        <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wrong_way'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'#type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'textfield'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'#default_value'</span> <span style="color: #339933;">=&gt;</span> check_plain<span style="color: #009900;">&#40;</span><span style="color: #000088;">$user_supplied</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>  <span style="color: #666666; font-style: italic;">//←-escaped twice</span>
        <span style="color: #0000ff;">'#description'</span> <span style="color: #339933;">=&gt;</span> t<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Old data: !data&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'!data'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$user_supplied</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// XSS</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'right_way'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'#type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'textfield'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'#default_value'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$user_supplied</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'#description'</span> <span style="color: #339933;">=&gt;</span> t<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Old data: @data&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'@data'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$user_supplied</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Form elements &#8211; #options when #type = checkboxes or #type = radios<br />
Examples:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>23
24
25
26
27
28
29
30
31
32
33
34
35
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>php<span style="color: #339933;">&gt;</span>
&nbsp;
        <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wrong_way'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
          <span style="color: #0000ff;">'#type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'checkboxes'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'#options'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user_supplied0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$u_supplied1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'right_way'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
          <span style="color: #0000ff;">'#type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'checkboxes'</span><span style="color: #339933;">,</span>
          <span style="color: #0000ff;">'#options'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>check_plain<span style="color: #009900;">&#40;</span><span style="color: #000088;">$user_supplied0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> check_plain<span style="color: #009900;">&#40;</span><span style="color: #000088;">$user_supplied1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Form elements &#8211; #value of #type markup and item need to be safe.<br />
Note that the default form element #type is markup!<br />
Examples:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>php<span style="color: #339933;">&gt;</span>
&nbsp;
        <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wrong_way'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#value'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//XSS</span>
        <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'right_way'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#value'</span> <span style="color: #339933;">=&gt;</span> check_plain<span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #666666; font-style: italic;">//       - or -</span>
        <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'right_way'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#value'</span> <span style="color: #339933;">=&gt;</span> theme<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>This information was gleaned from the Drupal documentation at “Handle text in a secure fashion”, which covers this topic more extensively than this post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/drupal-6-drupal-7/drupal-security-best-practices-when-outputting-text-into-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Get All the Selected Values from a Multi-Select with jQuery</title>
		<link>http://www.rubberneckdesigns.com/javascript-tips/how-to-get-all-the-selected-values-from-a-multi-select-with-jquery/</link>
		<comments>http://www.rubberneckdesigns.com/javascript-tips/how-to-get-all-the-selected-values-from-a-multi-select-with-jquery/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 19:27:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[javaScript Tips]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=471</guid>
		<description><![CDATA[Need to know how to get all the selected values or text values from a multi select element (drop down)? Its simple with jQuery! Start by declaring an array. One for the values of the multi select element and one for the text values. Well, if you even need the text values from the multi [...]]]></description>
			<content:encoded><![CDATA[<p>Need to know how to get all the selected values or text values from a multi select element (drop down)? Its simple with jQuery!</p>
<p>Start by declaring an array. One for the values of the multi select element and one for the text values. Well, if you even need the text values from the multi select, that is.</p>
<p>Now we can use the ‘ :selected’ jQuery selector. That we get all the items from the select element that the user has selected. We can use the jQuery ‘each()’ function to iterate over the select element and gather the values and texts into the arrays using jQuery’s standard ‘.val()’ and ‘.text()’ functions.</p>
<p>Next iterate through the selected items, using the standard val() to return the selected option’s value or text() to grab the actual display text that made up the list item.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">&nbsp;
$document.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> vals <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> textvals <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> getMultipleSelectVals<span style="color: #009900;">&#40;</span> id <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  $<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'#'</span> <span style="color: #339933;">+</span> id <span style="color: #339933;">+</span> <span style="color: #3366CC;">' :selected'</span> <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> i<span style="color: #339933;">,</span> selected <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      vals<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span> selected <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      textvals<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span> selected <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #006600; font-style: italic;">// end function</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #006600; font-style: italic;">//$document.ready</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/javascript-tips/how-to-get-all-the-selected-values-from-a-multi-select-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Build Drupal Form Elements BEFOR the AJAX Callback is Called</title>
		<link>http://www.rubberneckdesigns.com/drupal-6-drupal-7/build-drupal-form-elements-befor-the-ajax-callback-is-called/</link>
		<comments>http://www.rubberneckdesigns.com/drupal-6-drupal-7/build-drupal-form-elements-befor-the-ajax-callback-is-called/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 21:00:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal 6 & Drupal 7]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=421</guid>
		<description><![CDATA[I just lost two days of productive development time trying to figure out why AJAX was breaking in one of the steps of a form I am building in Drupal. As it turns out, a very important, and not at all obvious, thing to remember when developing a Drupal form is that the Drupal Forms [...]]]></description>
			<content:encoded><![CDATA[<p>I just lost two days of productive development time trying to figure out why AJAX was breaking in one of the steps of a form I am building in Drupal. As it turns out, a very important, and not at all obvious, thing to remember when developing a Drupal form is that the Drupal Forms API needs to define the form fields BEFORE the AJAX callback is fired.</p>
<p>The form I was working on was up until now, being built in such a way that this was not a problem. However, when I started working on a select element that uses AJAX to call an undetermined number of subsequent select elements, I decided to put that logic inside of the callback function. That was a “bad move”. The callback function needs to call upon a $form array that has already been built. Logically, I figured that I could just add to the existing $form array before returning it via the AJAX callback function. After all since I ad not yet returned it, why not? Well the reason why not is buried somewhere in the Drupal Forms API I suppose.</p>
<p>So, be sure to build the form elements into the $forms array prior to the AJAX callback function getting called.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/drupal-6-drupal-7/build-drupal-form-elements-befor-the-ajax-callback-is-called/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Access AJAX Returned Elements with JQuery&#8217;s .delegate()</title>
		<link>http://www.rubberneckdesigns.com/web-design/access-ajax-returned-elements-with-jquerys-delegate/</link>
		<comments>http://www.rubberneckdesigns.com/web-design/access-ajax-returned-elements-with-jquerys-delegate/#comments</comments>
		<pubDate>Fri, 20 May 2011 20:36:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=349</guid>
		<description><![CDATA[I love the way jQuery handles AJAX. With jQuery you can do so much more with so much less code. So once an AJAX call returns some HTML containing elements that you wish to manipulate further with jQuery how do you access it? You may have noticed that AJAX returned elements are not visible to [...]]]></description>
			<content:encoded><![CDATA[<p>I love the way jQuery handles AJAX. With jQuery you can do so much more with so much less code. So once an AJAX call returns some HTML containing elements that you wish to manipulate further with jQuery how do you access it? You may have noticed that AJAX returned elements are not visible to jQuery. Since AJAX is asynchronous the document ready has already been established so for instances like these we need to think ahead. Fortunately there is a very cool jQuery core function named .deligate().</p>
<p><a href="http://api.jquery.com/delegate/">.deligate()</a> is used to attach a handler to one or more events for all the elements that match the selectore. This happens for both the present and the future and is based on a set of root elements.</p>
<p>By using delegate() we can prepare jQuery to look for elements that have net been created yet. So, when your AJAX calls return their resulting elements now you can work with them using jQuery.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/web-design/access-ajax-returned-elements-with-jquerys-delegate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

