Forums

Update List with no records selected alert message

MainsailSoftware 28 Jun, 2015
I have added Direct list editing into a CCv5 listing. It is working as expected, but I am running into one issue. As part of my testing I was checking to see what happens if a User were to click the Update List button without having selected any records. I get an alert that shows the URL of the website and "says:" but with no message following.

The jQuery code CCv5 generates is as follows:
jQuery("#toolbar-button-save_list").css('background', 'url("https://<website url>/libraries/cegcore/assets/images/toolbar/save_list.png") no-repeat top center #F6F6F6');
		jQuery("#toolbar-button-save_list").on('click',
			function(){
				if(jQuery('#admin_form input.gc_selector:checked').length > 0){
					jQuery('#admin_form').attr('action', jQuery("#toolbar-button-save_list").data("url"));
					jQuery('#admin_form').submit();
				}else{
					alert("");
					return false;
			}


You can see that the alert has an empty string as its message.

How can I set a more appropriate and/or custom message to be displayed informing the user they must select at least one record to be updated?
MainsailSoftware 28 Jun, 2015
I did find this in ../cegcore/locales/en_gb/lang.php

const SELECTION_REQUIRED = "Please make at least 1 selection.";


but it does not seem to be being used?
GreyHead 29 Jun, 2015
Hi MainSailSoftware,

I'm no expert in CCv5 but digging around it looks as if the alert message should default to the one you found - I can’t see why that is failing from looking at the code.

You might be able to use the renderButton method to add a message
$this->view->Toolbar->renderButton("button_id", "link_href", "TEXT", "image_path", "submit_selectors", 'Some message here');

Bob
MainsailSoftware 29 Jun, 2015
Hummm... Maybe Max could have a look too...

One thing I will try relates to the Language default I am using: en-US

Let me try copying the ../cegcore/locales/en_gb/ content into ../cegcore/locales/en_us/ and see if that fixes things.
MainsailSoftware 29 Jun, 2015
I tried changing the default Language for both the front and admin to en-GB with no change.

I then changed them back to en-US, and did the copy of ../cegcore/locales/en_gb/ content into ../cegcore/locales/en_us/, also changing the Namespace from GCore\Locales\EnGb to GCore\Locales\EnUs. No change to the alert().

I will try creating a custom toolbar button, but in the past I have seen different behavior in the front-end between the standard _TOOLBAR_<button>_ and $this->view->Toolbar->renderButton() generated buttons; specifically: button positioning and module hiding do not act the same.
MainsailSoftware 30 Jun, 2015
2 Likes
After a few hours of digging through the CCv5 and cegcore code I found where the "BUG" resides.

/administrator/components/com_chronoconnectivity5/chronoconnectivity/helpers/lister.php

Line 29 needs to be changed From:
$button = $this->view->Toolbar->renderButton('save_list', r_('index.php?ext=chronoconnectivity&cont=lists&act=save_list&ccname='.$connection['Connection']['title']), l_('UPDATE_LIST'), $this->view->Assets->image('save_list', 'toolbar/'), 'submit_selectors');


changed, by adding , l_('SELECTION_REQUIRED') To:
$button = $this->view->Toolbar->renderButton('save_list', r_('index.php?ext=chronoconnectivity&cont=lists&act=save_list&ccname='.$connection['Connection']['title']), l_('UPDATE_LIST'), $this->view->Assets->image('save_list', 'toolbar/'), 'submit_selectors', l_('SELECTION_REQUIRED'));


I modified the code on my website, tested, and did not find any unexpected side effects.

Please let Max know what I found and if my fix is correct one.
NickOg 23 Aug, 2015
Thanks MainSailSoftware. Much appreciated. Nick
GreyHead 23 Aug, 2015
Hi MainsailSoftware,

Thank you, well found - please let Max know directly through the Contact Us menu above with a link to this thread.

Bob
This topic is locked and no more replies can be posted.