3 Replies - 1694 Views - Last Post: 06 August 2015 - 03:03 PM

#1 ryanol1215   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 06-August 15

Confirm Box work - around for Google Chrome

Posted 06 August 2015 - 12:17 PM

Hello -

I am currently working for a company that is going to be transferring over to Chrome. Some of our forms have Javascript confirm box validations, that require a response from the user to click 'OK' or 'Cancel'. If the user were to click 'Cancel' and then try to click the same button again that allows for the confirm box validation to appear there will then be an option to "prevent this page from creating additional dialogues" automatically set in Google. The problem is, if a user clicks this option, when trying to click that submit button again the confirm box validation will not display but the form will not do anything either. I am trying to find a work around for this issue or a solution. Any thoughts or ideas would be greatly appreciated - thank you!

Is This A Good Question/Topic? 0
  • +

Replies To: Confirm Box work - around for Google Chrome

#2 andrewsw   User is online

  • Entwickler
  • member icon

Reputation: 6604
  • View blog
  • Posts: 26,910
  • Joined: 12-December 12

Re: Confirm Box work - around for Google Chrome

Posted 06 August 2015 - 12:21 PM

Question moved to Javascript forum. Java and Javascript are completely different languages.
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw   User is online

  • Entwickler
  • member icon

Reputation: 6604
  • View blog
  • Posts: 26,910
  • Joined: 12-December 12

Re: Confirm Box work - around for Google Chrome

Posted 06 August 2015 - 12:51 PM

"prevent this page from creating additional dialogues"

This is a client message and setting that you cannot change.

The answer is not to use alert() and confirm() dialogs in production code, they are only of limited use in the early stages of learning JS.

Replace them with in-page messages or design your own discrete versions of these dialogs using HTML elements and positioning. There are many pre-built versions and tutorials available to achieve this.
Was This Post Helpful? 0
  • +
  • -

#4 felgall   User is offline

  • D.I.C Regular

Reputation: 68
  • View blog
  • Posts: 365
  • Joined: 22-February 14

Re: Confirm Box work - around for Google Chrome

Posted 06 August 2015 - 03:03 PM

View Postandrewsw, on 07 August 2015 - 05:51 AM, said:

The answer is not to use alert() and confirm() dialogs in production code,


I agree. These were re-purposed as debugging tools when the death of Netscape 4 made them unnecessary in production code (as more modern browsers present many different alternatives where you have complete control).

The turn off further dialogs is a debugging feature added to all dialogs after the first one in some browsers as an alternative to the "turn off Javascript for this page" that other browsers display on all dialogs including the first one.

As some people forget to remove these debugging dialogs from their code before it goes live I simply turned off alert in my browser and confirm simply returns true without displaying anything.

See http://t4t5.github.io/sweetalert/ for one alternative if you still want to use a dialog rather than simply updating the page itself.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1