?
Referenced as Pull Request for: # 28897
avatar ankush-maherwal
ankush-maherwal
19 Oct 2019

Steps to reproduce the issue

  1. Go to com_users
  2. Click on "New" button to create a new user
  3. Without filling mandatory fields click on "Save" button
  4. Also, check the behaviour for "Save & Close" button

For the "Save & Close" button client-side validations are executed but not for the "Save" button

Expected result

Client-side validations should be executed for "Save" button and form should not be submitted if the fields in the form contain invalid data

Actual result

On click of "Save" button even if the form contains invalid data the form is submitted

System information (as much as possible)

Joomla 4.0.0-alpha12
Linux server

Additional comments

Votes

# of Users Experiencing Issue
1/2
Average Importance Score
3.50

avatar ankush-maherwal ankush-maherwal - open - 19 Oct 2019
avatar joomla-cms-bot joomla-cms-bot - labeled - 19 Oct 2019
avatar brianteeman
brianteeman - comment - 19 Oct 2019

I could not replicate this error report

avatar ankush-maherwal
ankush-maherwal - comment - 19 Oct 2019

It seems that the client-side validations are not executed on click of "save" i.e apply button for any of the inbuilt extension except article creation

Code generated or save button for article

<joomla-toolbar-button id="toolbar-apply" task="article.apply" form-validation="">
<button class="button-apply  btn btn-sm btn-success" type="button">
	<span class="icon-apply" aria-hidden="true"></span>
	Save</button>
</joomla-toolbar-button>

Code generated for save button for user creation

<joomla-toolbar-button id="toolbar-apply" task="user.apply">
<button class="button-apply  btn btn-sm btn-success" type="button">
	<span class="icon-apply" aria-hidden="true"></span>
	Save</button>
</joomla-toolbar-button>

form-validation="" is the extra attribute in the button HTML which is missing in "save" button of user creation view

avatar Didldu-Florian
Didldu-Florian - comment - 19 Oct 2019

I could reproduce it!

avatar brianteeman
brianteeman - comment - 19 Oct 2019

valid

avatar Quy Quy - close - 13 Dec 2019
avatar Quy Quy - change - 13 Dec 2019
Status New Closed - Unconfirmed Report
Closed_Date 0000-00-00 00:00:00 2019-12-13 03:37:18
Closed_By Quy
avatar Quy Quy - change - 13 Dec 2019
Status Closed - Unconfirmed Report Pending
Closed_Date 2019-12-13 03:37:18
Closed_By Quy
avatar Quy Quy - reopen - 13 Dec 2019
avatar SharkyKZ
SharkyKZ - comment - 13 Dec 2019

Same with almost every other form. Contact, Tag, User Note, User Level, etc.

avatar SharkyKZ
SharkyKZ - comment - 13 Dec 2019

I see 2 options:

  1. Not use Joomla\CMS\ToolbarHelper::apply() here.
  2. Make use of methods defined in Joomla\CMS\Toolbar\CoreButtonsTrait in Joomla\CMS\Toolbar\ToolbarHelper.

@asika32764 What do you think?

avatar asika32764
asika32764 - comment - 13 Dec 2019

I need check the code, since the HTML side was changed to CE, I' not sure the form validation process how to work with toolbar buttons

avatar SharkyKZ
SharkyKZ - comment - 13 Dec 2019

It's not to do with CE but with ToolbarHelper adding a button in a basic way:

public static function apply($task = 'apply', $alt = 'JTOOLBAR_APPLY')
{
$bar = Toolbar::getInstance('toolbar');
// Add an apply button
$bar->appendButton('Standard', 'apply', $alt, $task, false);
}

Instead we can use the trait which also enables validation:

public function apply(string $task, string $text = 'JTOOLBAR_APPLY'): StandardButton
{
return $this->standardButton('apply', $text)
->task($task)
->formValidation(true);
}

My question is whether we should make the changes in ToolbarHelper or remove the uses of ToolbarHelper in views and use trait methods directly.

avatar asika32764
asika32764 - comment - 13 Dec 2019

I see,

I think we can try proxy ToolbarHelper::apply() to CoreButtonsTrait::apply() so that all components which uses ToolbarHelper won't break and keep B/C.

CoreButtonsTrait has already uses by Toolbar class so we can do like this:

class ToolbarHelper 
{
    public static apply(...) 
    {
        $bar = Toolbar::getInstance('toolbar'); 
        return $bar->apply(...);
    }
}
avatar jwaisner
jwaisner - comment - 4 Jan 2020

I cannot reproduce this issue in 4.0.0-beta1-dev. I am using Firefox for the browser and MYSQL for database.


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

avatar vbv2312
vbv2312 - comment - 9 Jan 2020

how to know if the client side verification is happening or not ??
can't reproduce the issue

avatar ankush-maherwal
ankush-maherwal - comment - 10 Jan 2020

@vbv2312 The form is getting submitted even if the required fields are not filled. If the client-side validations are working then the form will not be submitted at all if any required filed is not filled.

avatar Quy Quy - change - 28 Apr 2020
Title
No client side validations are executed while creating new user from backend
[4.0] No client side validations are executed while creating new user from backend
avatar Quy Quy - edited - 28 Apr 2020
avatar jwaisner jwaisner - change - 28 Apr 2020
Status Pending Confirmed
avatar joomla-cms-bot joomla-cms-bot - change - 1 May 2020
Closed_By SharkyKZ joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 1 May 2020
avatar SharkyKZ SharkyKZ - change - 1 May 2020
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2020-05-01 12:49:12
Closed_By SharkyKZ
avatar joomla-cms-bot
joomla-cms-bot - comment - 1 May 2020

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

avatar SharkyKZ
SharkyKZ - comment - 1 May 2020

Please test PR #28897.


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

Add a Comment

Login with GitHub to post a comment