?
avatar mojazz
mojazz
4 Feb 2018

Steps to reproduce the issue

Define a textfield in XML that includes inputmode

<field name="amount" type="text" default="" label="Amount" description="Amount" hint="Amount" class="form-control" inputmode="numeric" />

Expected result

<input type="text" name="jform[amount]" id="jform_amount"  value="" class="form-control"     placeholder="Amount"     autocomplete="off"      inputmode="numeric"  />

Actual result

<input type="text" name="jform[amount]" id="jform_amount"  value="" class="form-control"     placeholder="Amount"     autocomplete="off"      inputmode=" inputmode="numeric""  />

System information (as much as possible)

Joomla! 3.8.4
PHP 7.1.13
Apache/Linux

Additional comments

In order for this to work as expected for my component, I have overridden for now JFormFieldText to change Line 266 from:

$inputmode    = !empty($this->inputmode) ? ' inputmode="' . $this->inputmode . '"' : '';

to:

$inputmode    = !empty($this->inputmode) ? $this->inputmode : '';

I have not yet looked at other field types for how they handle inputmode

avatar mojazz mojazz - open - 4 Feb 2018
avatar joomla-cms-bot joomla-cms-bot - change - 4 Feb 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 4 Feb 2018
avatar mojazz mojazz - change - 4 Feb 2018
The description was changed
avatar mojazz mojazz - edited - 4 Feb 2018
avatar mojazz mojazz - change - 4 Feb 2018
The description was changed
avatar mojazz mojazz - edited - 4 Feb 2018
avatar mojazz mojazz - change - 4 Feb 2018
The description was changed
avatar mojazz mojazz - edited - 4 Feb 2018
avatar mbabker
mbabker - comment - 4 Feb 2018

Just at a glance, it looks like you're doing it wrong in the XML. Your XML field element should just do inputmode="numeric", it seems like you've got inputmode=" inputmode="numeric"" in your definition.

avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Feb 2018
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Feb 2018
Category Code style Fields
avatar mojazz
mojazz - comment - 4 Feb 2018

As above, this is the XML:

	<field name="amount"
		type="text"
		default=""
		label="Amount"
		description="Amount"
		hint="Amount"
		class="form-control"
		inputmode="numeric"
	/>

And if I had it incorrect in the XML, the override would make no difference.

avatar mojazz
mojazz - comment - 4 Feb 2018

Upon digging further, inputmode attribute HTML is set in JFormFieldText::getLayoutData() (Line 266)

$inputmode = !empty($this->inputmode) ? ' inputmode="' . $this->inputmode . '"' : '';

AND in the text field layout file "layouts\joomla\form\field\text.php" (Line 74)

!empty($inputmode) ? 'inputmode="' . $inputmode . '"' : '',

It seems to me that it should be defined in one place or the other, not both.

avatar Quy Quy - change - 10 Feb 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-02-10 02:10:39
Closed_By Quy
avatar joomla-cms-bot joomla-cms-bot - change - 10 Feb 2018
Closed_By Quy joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 10 Feb 2018
avatar joomla-cms-bot
joomla-cms-bot - comment - 10 Feb 2018

Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/19563

avatar Quy
Quy - comment - 10 Feb 2018

See PR #19632


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19563.

Add a Comment

Login with GitHub to post a comment