AnsweredAssumed Answered

How to create Hovering Dialogs in Sugar or move the Sugar Pop-up box next to a field?

Question asked by Josh Whitlow on Sep 9, 2015
Latest reply on Sep 11, 2015 by Josh Whitlow
Sugar 6.5.20

I was able to find this link here:
http://developer.sugarcrm.com/2011/03/18/howto-create-nice-looking-popup-message-boxes-in-sugar/

Which shows you to add the pop up message for an alert box. This works just fine. I'm doing validation and want the box to either appear next to the field, or to use some other method of popping up an error box when the user doesn't enter the correct string.

I really like hovering dialogue boxes, but am not very knowledgeable on how to implement them.
An example of how to use stackoverflows hovering dialogs was mentioned here:
http://stackoverflow.com/questions/758906/how-would-i-implement-stackoverflows-hovering-dialogs

However, that post is 6 years old now, and the syntax isn't all there/correct.

Would anyone know a simple way to get a dialog box to appear next to the field so that it stays there until the user enters the correct string?

My code below:

SUGAR.util.doWhen("typeof($('#assistant_email_c'))!= 'undefined'",    function() {
        YAHOO.util.Event.addListener(YAHOO.util.Dom.get("assistant_email_c"), 'change', validateEmail);
    }
);
function validateEmail() {
if (/^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$/.test(assistant_email_c.value) || $("#assistant_email_c").val() == "") {
    //Initialize button before calling
    $("#SAVE_FOOTER").button().button("enable");
    return (true);
    }
    else {
    YAHOO.SUGAR.MessageBox.show({msg: 'This is an invalid email format!', type: 'plain'} );
    //Initialize button before calling
    $("#SAVE_FOOTER").button().button("disable");
    return (false);
    }
}

Outcomes