Page MenuHomePhabricator

adding HTML5 input fields
Open, Needs TriagePublic

Description

I tried to create an Extension to get use of new HTML5 fields. https://github.com/DaSchTour/SemanticFormsHTML5 But I failed totaly because the fields I created where not displayed. Even when trying something simple like described here http://www.mediawiki.org/wiki/Extension:Semantic_Forms/Developers%27_documentation 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' : '';
		$html5input=$field_args['html5'];
		$html = <<<END
	<input id="$input_id" name="{$input_name}[value]" type="$html5input" class="$className" tabindex="$sfgTabIndex" $checked_str $disabled_text/>
END;
		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.

Details

Reference
bz38599

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
https://github.com/DaSchTour/SemanticFormsHTML5/tree/dev

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.