Prevent or Disable ONBLUR event

Use this board for starting discussions, asking questions, and giving advice on Web programming for the IBM i platform (and predecessors.)
Ake_Thai
New User
Posts: 8
Joined: Mon Sep 23, 2019 5:56 am
First Name: Apimook
Last Name: Siriploypraguy
Company Name: Krungsri Auto PCL.
Phone: 0806043021
Address 1: 412 Prachautit Bangkok Thailand
City: Bangkok
State / Province: Outside Canada/USA
Zip / Postal Code: 10140
Country: Thailand
Contact:

Prevent or Disable ONBLUR event

Post by Ake_Thai »

I want to Prevent or Disable ONBLUR event from Textbox1 by using Javascript at ONFOCUS from Textbox2 in Rich Display file,
Do you have any function to disable ONBLUR Event ?

Thanks in Advance,
Apimook
Developer
User avatar
matt.denninghoff
Profound Logic Staff Member
Posts: 115
Joined: Wed Feb 10, 2016 3:53 pm
First Name: Matthew
Last Name: Denninghoff
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: Prevent or Disable ONBLUR event

Post by matt.denninghoff »

It is not possible to prevent events from firing; the browser will always trigger them. And there is no simple way to detach an event handler from a widget like how you described.

If you have code that runs in the Profound UI "onblur" event that you would want to disable sometimes and not other times, I would recommend having that "onblur" code check a global boolean variable before running. You could set that variable in your "onfocus" event.

e.g. in onfocus:

Code: Select all

window.mydisableOnblur = true;
and in onblur:

Code: Select all

if (!window.mydisableOnblur){
  //do something
}
window.mydisableOnblur = false;
Ake_Thai
New User
Posts: 8
Joined: Mon Sep 23, 2019 5:56 am
First Name: Apimook
Last Name: Siriploypraguy
Company Name: Krungsri Auto PCL.
Phone: 0806043021
Address 1: 412 Prachautit Bangkok Thailand
City: Bangkok
State / Province: Outside Canada/USA
Zip / Postal Code: 10140
Country: Thailand
Contact:

Re: Prevent or Disable ONBLUR event

Post by Ake_Thai »

Thank you Mr.Matthew , Your Information are very useful, Thanks ^^
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest