How warn users of data loss when they use browser back button in Joomla component

I am using Joomla 3 with BreezingForms.  Great form software.

On multi-page forms, if I press the back button, I lose everything entered.

Doing some searching, I find there are ways using javascript that I can embed in html code somewhere such as this, but I don't know where to add such code... and I think this is more of a hack than adding the code to a place designated by joomla or a component (e.g. in a "run these scripts before form loads" section)

What is best practices way to warn user from within a Joomla component that they will lose data if they click OK?
SAbboushiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

COBOLdinosaurCommented:
Not only is it a hack it does not deal with the real issue which is lost data.  You are going to create a less user friendly and less accessible page if you start trying to restrict movement.

You are better to just put a prominent message on the page not to use the back button without first saving the data.  

If you actually want to use the hack then it has to go in the head with the rest of the scripting, and it will almost certainly either not work or screw up something else in the page because Joomla is very scripting intensive and you will almost certainly create a conflict.

As a side note please do not post links to that site on EE. Such links are no longer permit as they create more problems than they solve.

Cd&
0
SAbboushiAuthor Commented:
k thanks-

Anyone else that can help me address this issue?
0
Ray PaseurCommented:
I am by no means a Joomla Expert.  But having said that, let's look at this part of the question:
On multi-page forms, if I press the back button, I lose everything entered.
That tells me that (1) the multi-page form is a bad idea, and (2) the ability to remember the content may not be well-implemented in Joomla.

Why is there a multi-page form?  Is there any alternative, such as producing a series of page-by-page forms.  Each form can update the data base as it is submitted, and each form script can use the prior contents of the data base to prepopulate the data in the next form.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

GaryCommented:
Why don't you open the form page in a new tab - that way there is no history to go back to
Simple and no hacks
You just need to add target="_blank" to any links that point to this form page
0
SAbboushiAuthor Commented:
Ray_Paseur - thanks for that; unfortunately I am limited by the features of the BreezingForms component

GaryC123: that sounds like a great idea!  But... Grrrr..... in the Joomla Menu Item, the Link is not editable... any ideas?
0
GaryCommented:
Not sure about Joomla but when you create/edit the menu item, choose 'Open in a new window with navigation'
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SAbboushiAuthor Commented:
I create/edit the menu item in joomla!  I don't see such an option...
0
GaryCommented:
Do you have something like this
http://docs.joomla.org/Help31:Menus_Menu_Item_External_URL
See the Target Window
0
SAbboushiAuthor Commented:
Thanks - found it... but still can't get it to work.

For the BreezingForms component, I need to Create Menu Item, Click "Select" for Menu Item Type, Select "BreezingForms" component which only has the option "Add Form"; so Menu Item Type now shows: "Add Form".
Then in the Advanced Options of the Menu Item, I need to specify the Form Name
The Link field in the Menu Item shows: index.php?option=com_breezingforms&view=form

When I go to the website and select the menu item, the resulting URL is

http://www.leasetobuyhouston.com/index.php/tenant-buyer-application

Creating a Menu Item (named "TBA") as you've suggested with the Link index.php?option=com_breezingforms&view=form&target="_blank" and then clicking on TBA Menu Item from the site menu gives an error message "[No form id or name provided!]".  URL when click on TBA: http://www.leasetobuyhouston.com/index.php/component/breezingforms/view/form/target/?target=

Hope we're getting closer... ; )
0
SAbboushiAuthor Commented:
Here's what I needed:

http://www.leasetobuyhouston.com/index.php?option=com_breezingforms&view=form&ff_name=TenantBuyerApplication

Open in new window


And there is the option you mentioned:
Target Window: New Window with Navigation

Perfect!  Thanks--
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Joomla

From novice to tech pro — start learning today.