Feature/html5 #743

Closed
wants to merge 3 commits into
from

Projects

None yet

5 participants

@tobz-nz
tobz-nz commented Dec 6, 2011

Added html5 datalist to form helper.

@tobiasmathes

I hope you know that an empty array is also considered to be an array?

$options = array();

if (is_array($options)) {
print_r($options);
}

@narfbg narfbg commented on the diff Jun 21, 2012
system/helpers/form_helper.php
@@ -242,6 +242,54 @@ function form_input_range($data = '', $min = 0, $max = 0, $step = 0, $value = ''
// ------------------------------------------------------------------------
/**
+ * Datalist
+ *
+ * Create an html5 datalist.
+ *
+ * @access public
+ * @param array $options
+ * @param mixed $attributes
+ */
+if ( ! function_exists('form_datalist')) {
@narfbg
narfbg Jun 21, 2012 Collaborator

Curly braces need to be placed on separate lines, like you've done with the if()s.

@narfbg narfbg commented on the diff Jun 21, 2012
system/helpers/form_helper.php
+ if ( ! is_array($options))
+ {
+ return $options;
+ }
+
+ // Were any other attributes submitted? If so generate a string
+ if (is_array($attributes))
+ {
+ $atts = '';
+ foreach ($attributes as $key => $val)
+ {
+ $atts .= ' ' . $key . '="' . $val . '"';
+ }
+ $attributes = $atts;
+ }
+ elseif (is_string($attributes) AND strlen($attributes) > 0)
@narfbg
narfbg Jun 21, 2012 Collaborator

AND -> &&

@narfbg narfbg commented on the diff Jun 21, 2012
system/helpers/form_helper.php
+ $atts = '';
+ foreach ($attributes as $key => $val)
+ {
+ $atts .= ' ' . $key . '="' . $val . '"';
+ }
+ $attributes = $atts;
+ }
+ elseif (is_string($attributes) AND strlen($attributes) > 0)
+ {
+ $attributes = ' '. $attributes;
+ }
+
+ $out = "<datalist id=\"$id\"$attributes>\n";
+ foreach ($options as $key => $val)
+ {
+ $out .= " ";
@narfbg
narfbg Jun 21, 2012 Collaborator

Those 4 lines should be just one:

$out .= ' <option>'.$val."</option>\n";
@cryode
Contributor
cryode commented Dec 24, 2012

Anyone else have a small issue with adding support for HTML5 elements, which are not an official spec yet and subject to changes? Data lists aren't even supported in Chrome yet, let alone IE and older versions of FF and Opera.

@tobz-nz Paging pull request author! Can we do something about getting this optimized and up-to-date with the current 3.0 repo?

@ragingdave
Contributor

Hey was going to start pushing some updates for this issue in a new pull request, was wondering how to go about pulling in the latest dev changes into the feature branch, or instead, just re-create a feature from a new set of pull requests based off dev?

@ragingdave ragingdave added a commit to ragingdave/CodeIgniter that referenced this pull request Sep 26, 2013
@ragingdave ragingdave rework of #743
updated changelog.rst
updated form_helper.rst
added currently merged features
cleaned up code a bit
d80d0e3
@narfbg
Collaborator
narfbg commented Jan 24, 2014

@DaveMC08

I don't really understand your question, but pulling changes in is as simple as:

git pull git@github.com:EllisLab/CodeIgniter.git <branch>

Closing this PR now ... old, questionable, no response from the author ...

@narfbg narfbg closed this Jan 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment