Link to home
Start Free TrialLog in
Avatar of SAbboushi
SAbboushiFlag for United States of America

asked on

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?
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

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&
Avatar of SAbboushi

ASKER

k thanks-

Anyone else that can help me address this issue?
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.
SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I create/edit the menu item in joomla!  I don't see such an option...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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... ; )
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--