jQuery in iForms

135 views
Skip to first unread message

kimc

unread,
Oct 16, 2012, 4:19:36 PM10/16/12
to heo-i...@googlegroups.com
I am new to I forms and want to use some jQuery code.  Where do I load this on the HEO server to be able to start using it?

Russ Garlow

unread,
Oct 16, 2012, 4:28:41 PM10/16/12
to heo-i...@googlegroups.com
Hi Kim, Welcome to the wonderful world of iForms :-)

Here's a good place to start on where to put things on your server.

Do you have much experience with JQuery and Javascript?

At the very least you'll need to download JQuery here, but if you're just starting, you'll probably want to take a hard look at using JQuery UI which comes with the core JQuery libraries and give you a LOT more functionality.

whichever way you decide to go, the article at the top will give you an idea on where to put it.

Good Luck!

Russ

Jason Murray

unread,
Oct 17, 2012, 10:11:51 AM10/17/12
to heo-i...@googlegroups.com
We keep all of our resources (js/css/etc) on an application server and just use fully qualified paths.


On Tuesday, October 16, 2012 4:19:37 PM UTC-4, kimc wrote:

Bryan Benavides

unread,
Oct 19, 2012, 1:22:39 PM10/19/12
to heo-i...@googlegroups.com
One thing you'll want to watch out for using some versions of JQuery UI is that the $(document).ready method can throw an error from the HEO browser. I wrestled with this one long and hard when I started putting JQuery code into my forms.
 
There's an easy workaround though:
 
function silentErrorHandler(){return true;}
window.onerror=silentErrorHandler;

Jason Murray

unread,
Oct 19, 2012, 1:25:10 PM10/19/12
to heo-i...@googlegroups.com
Thanks for that workaround. I've experienced that when calling the document.ready method from a script *in* the html, but not when I call it from an external js file. I have no clue why.

Scott Morris FMC

unread,
Oct 19, 2012, 1:33:37 PM10/19/12
to heo-i...@googlegroups.com
This should also fix that "bug" in IE:

<script type="text/javascript">
if (typeof $ == 'undefined') {
    window
.onerror = function (e) { return true; }
    window
.alert = function () { return true; }
}
</script>

Leon Frid

unread,
Nov 9, 2012, 9:14:04 PM11/9/12
to heo-i...@googlegroups.com

On Tuesday, October 16, 2012 4:19:37 PM UTC-4, kimc wrote:
I am new to I forms and want to use some jQuery code.  Where do I load this on the HEO server to be able to start using it?
 
 
 
very simple: use onload event. DOM object already all loaded at that time.
    

<body style="width: 90%" onload="init()">

Michael Burrows

unread,
Apr 30, 2014, 4:20:54 PM4/30/14
to heo-i...@googlegroups.com
Thanks for this. I am pretty familiar with jquery but never used it much in my forms. I decided to plug it in to one my forms to simplify a tabbed page and kept getting a mystery "object expected" error, which I could not replicate on my dev machine.

This little workaround saved me some hair. 

So is it only certain versions of the jquery ui that do this in HEO?

Thanks again,

Mike Burrows
Phoebe Putney Health System

Scott Morris

unread,
Apr 30, 2014, 4:29:01 PM4/30/14
to heo-i...@googlegroups.com
It's not really any particular version of jQuery (or jQueryUI) that causes this problem.  The issues is that, when an iForm is rendered in HEO, it goes through two passes.  First, the page is opened in a pseudo-browser, hidden to the user.  In this "sandbox" (we'll call it, for the lack of a better term), HEO pre-sets all of your form elements based on your VGR initialization code.  This is where, if you INIT,SET,TEXT,myTextbox,TO,"some value", it will modify your page and inject the value into the code.  Same thing happens for check boxes, radio buttons, dropdown boxes, etc.  It also replaces your @@ variables and your BASE_URLs.

The issue really comes up when there's javascript that's not set on a DOM ready event.  Because it's somewhat of  a browser environment, if it finds javascript out there to run, it will try to run it.  Since it's not really getting links to your external files (jQuery library included), it can't figure out what to do with your dollar sign ($) code.  The same thing happens if you just happen to have some javascript in the middle of your page that attempts to run your own home-grown function that lives in an external JS file.

Hope this helps

Michael Burrows

unread,
Apr 30, 2014, 4:33:11 PM4/30/14
to heo-i...@googlegroups.com
Makes perfect sense. Thanks again, and thanks also for the explanation!

Mike Burrows
Phoebe Putney Health System
--
You received this message because you are subscribed to a topic in the Google Groups "HEO iForms" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/heo-iforms/sVcY2oRuTqA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to heo-iforms+...@googlegroups.com.
To post to this group, send email to heo-i...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/heo-iforms/b3c7ba49-8ffb-49db-9687-c7b6e8d3f9f9%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Jason Murray

unread,
May 1, 2014, 10:09:40 AM5/1/14
to heo-i...@googlegroups.com
Slightly related....

I have a document.ready() call in my iform.js file that includes this:
$(document).ready(function ()
{
// ... other code...

if (typeof documentReady == "function")
documentReady();
}

Then in my htm file I include a function called documentReady() if there's anything I want to do onload. Or I just leave it out if there's nothing I want to do. $(document).ready() doesn't work directly in the htm but this is an easy way around it if you are using a common js file.

-Jason.


________________________________
--
You received this message because you are subscribed to the Google Groups "HEO iForms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to heo-iforms+...@googlegroups.com.
To post to this group, send email to heo-i...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/heo-iforms/b3c7ba49-8ffb-49db-9687-c7b6e8d3f9f9%40googlegroups.com <https://groups.google.com/d/msgid/heo-iforms/b3c7ba49-8ffb-49db-9687-c7b6e8d3f9f9%40googlegroups.com?utm_medium=email&utm_source=footer> .
winmail.dat
Reply all
Reply to author
Forward
0 new messages