[Dojo-interest] Scope a global from load:function().

Bailo, John John.Bailo at Bowne.com
Thu Nov 9 12:27:04 MST 2006


Thank you!

That worked perfectly!

I put in

	sync: true


and was able to return values -- what you are saying is that because
it's async by default, it was returning from the outer function before
it had a chance to set the var.

-----Original Message-----
From: dojo-interest-bounces at dojotoolkit.org
[mailto:dojo-interest-bounces at dojotoolkit.org] On Behalf Of Fredrik
Johansson
Sent: Thursday, November 09, 2006 10:34 AM
To: dojo-interest at dojotoolkit.org
Subject: Re: [Dojo-interest] Scope a global from load:function().

I think you do a async io.bind()
so you exit loadQuestion before the load arrives

Have you tried to add sync: true to your bindArgs?

/ Fredrik

torsdag 09 november 2006 19:15 skrev Bailo, John:
> Variables in load:function() are local.
>
>
>
> How can I pass a variable back from this section to loadQuestion().
>
>
>
> In the example below, how can I return the value of
oquestion.questionid
> from loadQuestion()?
>
>
>
> In the example below, qid will not have the value of
> oquestion.questionid but its original value of 0.
>
>
>
> I have also tried setting the value of hidden form variables, but they
> revert to their original values after exiting the load:function()
>
>  function loadQuestion() {
>
>     var qid;
>
>       var bindArgs = {
>
>     url: "getQuestion1.jsp",
>
>     error: function(type, data, evt){
>
>      alert(data);
>
>                },
>
>     load: function(type, data, evt){
>
>             var oquestion=data;
>
>             //assume that oquestion.questionid = 1
>
>             qid=oquestion.questionid;
>
>
>
>     },
>
>             mimetype: "text/json",
>
>             formNode: document.getElementById("qaform1")
>
>    };
>
>
>
>    dojo.io.bind(bindArgs);
>
>
>
> return qid;
>
>   }
>
>
>
>
>
> John Bailo
> Web Developer
>
________________________________________________________________________
> _______________________________________
>
> Bowne Marketing & Business Communications
> 20017 72nd Ave S
> Kent, WA 98032
> Office: 253/437-7085
> Cell: 253/217-2776
> Fax: 253/872-5602
>
>
>
>
>
> CONFIDENTIALITY NOTICE:
>
> The information in this Internet email is confidential and may be
legally
> privileged.  It is intended solely for the addressee.  Access to this
email
> by anyone else is unauthorized.
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
Dojo-interest at dojotoolkit.org
http://dojotoolkit.org/mailman/listinfo/dojo-interest


CONFIDENTIALITY NOTICE:

The information in this Internet email is confidential and may be legally privileged.  It is intended solely for the addressee.  Access to this email by anyone else is unauthorized.




More information about the Dojo-interest mailing list