Page MenuHomePhabricator

adding HTML5 input fields
Open, Needs TriagePublic


I tried to create an Extension to get use of new HTML5 fields. But I failed totaly because the fields I created where not displayed. Even when trying something simple like described here It did not work. For example like this

global $sfgFormPrinter;
$sfgFormPrinter->setInputTypeHook('html5', 'sfHtml5', array());

function sfHtml5($cur_value, $input_name, $is_mandatory, $is_disabled, $other_args) {
		global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelect;

		if ( array_key_exists( 'class', $other_args ) ) {
			$className .= ' ' . $other_args['class'];
		$input_id = "input_$sfgFieldNum";
		$disabled_text = ( $is_disabled ) ? 'disabled' : '';
		$html = <<<END
	<input id="$input_id" name="{$input_name}[value]" type="$html5input" class="$className" tabindex="$sfgTabIndex" $checked_str $disabled_text/>
		return $html;

It only should enter the input of tje html5 attribut into the type field. I only get an non-type-error. It would be really great if someone could help with this. Would be nice to get the possibility for testing HTML5 input types. This way some of the jQuery workarounds could get obsolete in future.



Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:55 AM
bzimport set Reference to bz38599.

dasch wrote:

Here is the idea I had

I tried with color, number and email

dasch wrote:

Assining this to me. There were some problems when testing, because SemanticForms overrieds field that misses or do not fit with template.