Welcome, Guest
Username: Password: Remember me

TOPIC: Confirmation on Custom Task

Confirmation on Custom Task 23 Nov 2016 10:13 #14727

  • organicwebs
  • organicwebs's Avatar
  • Offline
  • Premium Member
  • Chris
  • Posts: 112
  • Thank you received: 19
  • Karma: 8
Hi,
I am having some trouble getting a confirmation popup working on a custom task. Any help appreciated.

It is in the Item View. When a user clicks "Submit" I would like a message to pop up to say "Are you sure you wish to Submit...?" - just like the Delete task works.



In my fork/views/_item/view.html.php file I have added this javascript....
<script type="text/javascript">
			Joomla.submitform = function(task)
			{
				if (task == 'device_item.submitdevice')
				{
					if (confirm(Joomla.JText._('Are you ready to Submit this device? It will then become locked.'))) {
						Joomla.submitform(task);
					} else {
						return false;
					}
				}
			}
		</script>





This is the line that creates the toolbar button...
// Submit
		JToolBarHelper::custom('device_item.submitdevice', 'cog', 'cog', "TEST_JTOOLBAR_SUBMIT", false);

. Thanks for any help - this has been driving me nuts all day :pinch:
Just call me Chris :)
The administrator has disabled public write access.

Confirmation on Custom Task 02 May 2017 12:48 #15091

  • organicwebs
  • organicwebs's Avatar
  • Offline
  • Premium Member
  • Chris
  • Posts: 112
  • Thank you received: 19
  • Karma: 8
Bump - any ideas on this?

Cheers
Just call me Chris :)
The administrator has disabled public write access.

Confirmation on Custom Task 03 May 2017 12:07 #15099

  • MorganL
  • MorganL's Avatar
  • Online
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 20
Are you sure you even need a custom task?

I used this in a publish button on a previous component that should work
<li class="btn btn-small " style="list-style:none; " id="toolbar-jobs.publish" onclick="if (document.adminForm.boxchecked.value==0){alert('Please first make a selection from the list.');}else{if (window.confirm('You are about to publish this job. Once listed you can only cancel the job to remove it. Are you sure you want this job to be listed?  ?'))return Joomla.submitform('jobs.publish');}">
	
<div class="" style="cursor:pointer">
		
<i class="icon-publish icomoon"></i>
		
<span class="text" style="white-space:nowrap">Publish</span>

	
</div>
</li>

You can obviously add parts of this to a button rather than a <LI> if you want but the principal is sound
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.
The following user(s) said Thank You: organicwebs
Time to create page: 0.071 seconds

Get Started