Javascript alert in Fancybox window

116 views
Skip to first unread message

Bram Wolf

unread,
Sep 23, 2014, 7:28:47 AM9/23/14
to fanc...@googlegroups.com
Hey Guys!

I've been searching around but couldn't find anything that worked so here goes,
I'm looking for a way to have a Javascript Alert show as a fancybox popup. 
I have a contact form, and a javascript that checks the input before sending it.
I would like for those error messages to show up in a fancybox.  

I'm not realy a Javascript star but I believe this post of the validator script produces 
the alert window:


function Validator(frmname)
{
  this.formobj=document.forms[frmname];
if(!this.formobj)
{
 alert("Error: couldnot get Form object "+frmname);
return;
}


It's located in a external .js file which in included into the HTML where I embedded
fancybox. How would U go about getting this to open in fancybox?


Thanx alot in advance!

Best regards,
Bram Wolf

JFK

unread,
Sep 23, 2014, 8:34:28 PM9/23/14
to fanc...@googlegroups.com
instead of this

 alert("Error: couldnot get Form object "+frmname);

try
var msg = "Error: couldnot get Form object " + frmname;
$.fancybox(msg);

demo : http://jsfiddle.net/Lhen7mv1/
Message has been deleted

Bram Wolf

unread,
Sep 24, 2014, 6:52:18 AM9/24/14
to fanc...@googlegroups.com
You just need to stop being so awesome! ;)

Thanks a million man! 
You just glued my happy back on :D
Reply all
Reply to author
Forward
0 new messages