Thursday, March 6, 2008

Turn Off Hover Over Screen Tips on Browser form

The easiest way to make a field required on an infopath form is to check the 'cannot be blank' box. The user must fill in data on the field to be able to submit the form. This also adds a red star to the field so the user knows they must enter data.

The problem is that it also adds a hover box which says 'Required' or something like that. This box is annoying to users because it often hovers over another field, blocking the user from entering data into the other field.

Here's how to get rid of it:

Edit the Core.JS file(12\template\layouts\inc)
Find the function called ErrorVisualization_ShowShortMessage, around line 5125.

You want to change this function to do nothing. the easiest way is to add: return; as the first line of code that it runs.
It should look something like:

function ErrorVisualization_ShowShortMessage(objControl,boolIsSticky){;
;
return;


The hover boxes won't appear anymore.

You could get a little fancier and have it check the error string. Then, in infopath, set the ones you don't want to show to be 'xxxx' or something. Have the function check the string. If is your 'xxxx' string, then return, else show the message.
For example, I added:
if(strErrorString=="Required" strErrorString=="Cannot be blank" strErrorString =="Only date allowed (example: 2001-03-14)") return;
after:
var strErrorString = objDatum.GetErrorMessage();

Now, my custom messages appear, but the default ones do not.

3 comments:

Unknown said...

thx that was very useful

Unknown said...

Is there a way to configure the 'hover over' screen to pop up on the righthand side of the control rather than the default left side?

Jeff Lester said...

Hi David,
It may be possible.
If you can track down the CSS that it uses, you should be able to change the placement. I haven't tried it, but that's where I would look.