[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

just4fun6969

9/29/2008 2:27:00 PM

I'm not sure if this is the right place for this question...

But I'm building a web application that will pre-populate a form using
AJAX and minimual user input. The problem is I want to make one
database call and to get all of the variables and then populate the
form.

However, I can't seems to find a way to pause execution of the
javascript until the method from the c# application has been returned.

Any ideas?
27 Answers

Cowboy

9/29/2008 4:53:00 PM

0

Why do you have to prepopulate using AJAX? Can't you fill out the form
(pre-populate) server side and then allow the rest to be worked with AJAX?

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/Greg...

or just read it:
http://feeds.feedburner.com/Gre...

********************************************
| Think outside the box! |
********************************************
<just4fun6969@gmail.com> wrote in message
news:8ae256e3-cf5a-44e0-973d-0d08b7357fed@w39g2000prb.googlegroups.com...
> I'm not sure if this is the right place for this question...
>
> But I'm building a web application that will pre-populate a form using
> AJAX and minimual user input. The problem is I want to make one
> database call and to get all of the variables and then populate the
> form.
>
> However, I can't seems to find a way to pause execution of the
> javascript until the method from the c# application has been returned.
>
> Any ideas?

just4fun6969

9/29/2008 8:45:00 PM

0

It's a web based data entry application and I'd rather not have the
delay associated with a post-back.

So far, what I'm using is:

var behavior1 = $find('dpLName');
behavior1.populate(myValue);
setTimeout("populateRemainder(myValue)",500);

The server side method for the DynamicPopulationExtender sets server
side variables then the other DynamicPopulationExtenders access those
server-side variables in the populateRemander function.

Essentially, I am forcing a delay to allow the behavior1 object to
populate. What I'd like to do is somehow call the behavior1.populate
method in a non-async way, that is, wait to proceed until it has
finished executing, but I don't know how to do that.

Cowboy

9/30/2008 1:49:00 AM

0

I think I am still missing something.

Does behavior1 populate the same, on initial form load, every time? If so, I
would do that server side. You have to go to the server to paint the form
the first time anyway.

If this is a form that shows up magically, you can still prepulate on the
server. You simply hide the form. But, I doubt that is your issue, as AJAX
would work fine even if you did not originally paint the form on initial
page load.

As for the question, there are certainly ways to add a stall into a
JavaScript routine. Even better, you create the intial load with a callback
and finish painting the form only when there is a return from the routine
that loads the behavior. If you want to see an example, there are things
like MooTools, which has a loading mechanism or the one MapQuest uses (which
escapes me at the moment). If you don't want the entire library, just grab
the code ... it is open source.

My point, however, is if the form gets loaded right after the person gets
the page from the server, just load it from the server. There is no rule
that states an AJAX page must use AJAX for initial load. If you don't have
to use AJAX for load, I would not kludge up a delay just so you did not load
from the server.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/Greg...

or just read it:
http://feeds.feedburner.com/Gre...

********************************************
| Think outside the box! |
********************************************
<just4fun6969@gmail.com> wrote in message
news:533a51bd-95ac-4f0c-acaf-8b847dc19b2d@q9g2000hsb.googlegroups.com...
> It's a web based data entry application and I'd rather not have the
> delay associated with a post-back.
>
> So far, what I'm using is:
>
> var behavior1 = $find('dpLName');
> behavior1.populate(myValue);
> setTimeout("populateRemainder(myValue)",500);
>
> The server side method for the DynamicPopulationExtender sets server
> side variables then the other DynamicPopulationExtenders access those
> server-side variables in the populateRemander function.
>
> Essentially, I am forcing a delay to allow the behavior1 object to
> populate. What I'd like to do is somehow call the behavior1.populate
> method in a non-async way, that is, wait to proceed until it has
> finished executing, but I don't know how to do that.
>

just4fun6969

9/30/2008 4:30:00 AM

0

Hey Cowboy - Thanks for your response and help!

The part I omitted, making it harder for you to follow, is this:

A. The form renders with empty fields
(name,address,phone,field1,field2, etc.)
B. The data entry person then types the information from a printout
and submits the form.
C. We have some of the information already available (say name and
address info)
D. When the data entry person enters the phone number - I want the
form (originally conceived as using AJAX) to look up the phone number
in the DB and populate name, address,city,state and zip so it saves
the data entry person some time.

Here's where I think my limited knowledge of AJAX is hurting me.... I
see four ways to solve the problem.

1. User submits the form and server side populates name and address -
this was rejected because the submit intrupts the data entry flow
2. use AJAX and DynamicPopulateExtender on name, addess,
city,state,zip. This was rejected because it would require 5 separate
DB look ups.
3. use AJAX and DynamicPopulateExtender return all 5 data elements to
a hidden input box and use javascript to parse and populate
name,address,city,state and zip - just didn't want to start down this
road yet...
4. My current approach - User AJAX and DynamicPopulationExtenders. The
server method on one field, say name, queries the DB and populates
server side variables for address, city,state, and zip. It returns
name. Then the DynamicPopulationExtender Server Side methods for
address, city, state, and zip just return the prepopulated server side
variable.

#4 works but it isn't fluid because of my arbitrary timeout. The
problem with #4 is getting it to execute the DynamicPopulationExtender
methods for address,city, state, and zip only AFTER the server side
method for name has completed. I think your suggestions are for an
initial page load solution??

I'm still trying to get it right :-)

Cowboy

9/30/2008 7:20:00 PM

0

You can have it so they enter the phone number and then submit. The data
transport can still be AJAX, but you are taking the "round trip" without a
repaint of the screen. I will have to think about the stall issue, as I am
sure there is a way around this. Since you are doing everything in
JavaScript with AJAX, you are a bit limited on what you can do.

When you say this is data entry, do you mean these are all internal users
(ie, company employees or contractors, not necessarily only those working in
the office)? If so, the web app direction may not be the best approach. You
can set up a click once windows app, for example. If delivery has to be web,
Silverlight is also an option, although I would head to Silverlight 2, which
is still beta. Either of these approaches gives a better data entry
experience.

I had to write an app years ago that was data entry. All JavaScript for the
data entry portion and I ended up using XmlHttp (the precursor of AJAX) for
my roundtripping. SO, I understand the pain. If you can get buy off on a
windows app, even if it has to be delivered via the web (click once) or a
more full featured browser plug in (Java applet, Flash, Silverlight), you
will find it easier for the data entry people. Of course, management does
not always give the option. :-)

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/Greg...

or just read it:
http://feeds.feedburner.com/Gre...

********************************************
| Think outside the box! |
********************************************
<just4fun6969@gmail.com> wrote in message
news:6e5401e0-4293-40ef-b5bd-71694dffc1d5@m3g2000hsc.googlegroups.com...
> Hey Cowboy - Thanks for your response and help!
>
> The part I omitted, making it harder for you to follow, is this:
>
> A. The form renders with empty fields
> (name,address,phone,field1,field2, etc.)
> B. The data entry person then types the information from a printout
> and submits the form.
> C. We have some of the information already available (say name and
> address info)
> D. When the data entry person enters the phone number - I want the
> form (originally conceived as using AJAX) to look up the phone number
> in the DB and populate name, address,city,state and zip so it saves
> the data entry person some time.
>
> Here's where I think my limited knowledge of AJAX is hurting me.... I
> see four ways to solve the problem.
>
> 1. User submits the form and server side populates name and address -
> this was rejected because the submit intrupts the data entry flow
> 2. use AJAX and DynamicPopulateExtender on name, addess,
> city,state,zip. This was rejected because it would require 5 separate
> DB look ups.
> 3. use AJAX and DynamicPopulateExtender return all 5 data elements to
> a hidden input box and use javascript to parse and populate
> name,address,city,state and zip - just didn't want to start down this
> road yet...
> 4. My current approach - User AJAX and DynamicPopulationExtenders. The
> server method on one field, say name, queries the DB and populates
> server side variables for address, city,state, and zip. It returns
> name. Then the DynamicPopulationExtender Server Side methods for
> address, city, state, and zip just return the prepopulated server side
> variable.
>
> #4 works but it isn't fluid because of my arbitrary timeout. The
> problem with #4 is getting it to execute the DynamicPopulationExtender
> methods for address,city, state, and zip only AFTER the server side
> method for name has completed. I think your suggestions are for an
> initial page load solution??
>
> I'm still trying to get it right :-)

lenel luc

1/17/2010 8:27:00 PM

0

"abourick" <bourrique_anne@yahoo.br> a ?crit dans le message de news:
C-KdnTk618Gw287WnZ2dnUVZ7vxi4p2d@giganews.com...

> Le syst?me dictatorial existe depuis bien avant l'arriv?e des Duvalier.
> Depuis l'ind?pendance de Ha?ti il n'a jamais cess?.

"le remboursement des millions de francs-or vers?s ? la France pendant des
d?cennies en ?change de la reconnaissance de l'ind?pendance. Cette somme
r?actualis?e, a ?t? estim?e par le gouvernement ha?tien ? 21 milliard de
dollars."

http://www.lepost.fr/article/2010/01/15/1888988_la-france-a-une-dette-envers-haiti-de-plusieurs-mill...


lenel luc

1/17/2010 8:41:00 PM

0


"alien" <alien999@gmail.com> a ?crit dans le message de news:
4b535b4d$1@news.stben.net...
> Le 17/01/2010 19:38, Diberville a ?crit :
>> Le 2010-01-17 13:24, Mulk a ?crit :
>>> [Default] On Sun, 17 Jan 2010 13:10:11 -0500, Diberville
>>> <Diberville@gmail.com> :
>>
>>>> "Haiti has a small mining industry, extracting minerals worth
>>>> approximately US$13 million annually. Bauxite, copper, calcium
>>>> carbonate, gold, and marble are the most extensively discovered
>>>> minerals
>>>> in Haiti. Lime and aggregates and to a lesser extent marble are
>>>> extracted. Gold was mined by the Spanish in early colonial times.
>>>> Bauxite was mined for a number of years in recent times at a site on
>>>> the
>>>> Southern peninsula. There are attempts to find commercially viable
>>>> copper and gold deposits but thus far none have begun.
>>>> http://en.wikipedia.org/wiki/Econom...
>>>
>>> ?crit en anglais et par qui ?
>>
>> Je parie que vous allez me dire "la CIA et les sionistes"...
>>
>>
>>
>
> il est fort l'incroyable Mulk :-))))

"Ressources naturelles: marbre, pierre ? chaux, calcaire et marne. Des
gisements de cuivre et d'or ne sont pas encore exploit?s."

http://www.alliance-haiti.com/societe/technique/ec...

http://www.haitiwebs.com/forums/business/48498-haiti_regorge_de_petrole_affirment_daniel_et_ginette_mat...



abourick

1/17/2010 10:21:00 PM

0

lenel luc a ?crit :
> "alien" <alien999@gmail.com> a ?crit dans le message de news:
> 4b535b4d$1@news.stben.net...
>> Le 17/01/2010 19:38, Diberville a ?crit :
>>> Le 2010-01-17 13:24, Mulk a ?crit :
>>>> [Default] On Sun, 17 Jan 2010 13:10:11 -0500, Diberville
>>>> <Diberville@gmail.com> :
>>>>> "Haiti has a small mining industry, extracting minerals worth
>>>>> approximately US$13 million annually. Bauxite, copper, calcium
>>>>> carbonate, gold, and marble are the most extensively discovered
>>>>> minerals
>>>>> in Haiti. Lime and aggregates and to a lesser extent marble are
>>>>> extracted. Gold was mined by the Spanish in early colonial times.
>>>>> Bauxite was mined for a number of years in recent times at a site on
>>>>> the
>>>>> Southern peninsula. There are attempts to find commercially viable
>>>>> copper and gold deposits but thus far none have begun.
>>>>> http://en.wikipedia.org/wiki/Econom...
>>>> ?crit en anglais et par qui ?
>>> Je parie que vous allez me dire "la CIA et les sionistes"...
>>>
>>>
>>>
>> il est fort l'incroyable Mulk :-))))
>
> "Ressources naturelles: marbre, pierre ? chaux, calcaire et marne. Des
> gisements de cuivre et d'or ne sont pas encore exploit?s."
>
> http://www.alliance-haiti.com/societe/technique/ec...
>
> http://www.haitiwebs.com/forums/business/48498-haiti_regorge_de_petrole_affirment_daniel_et_ginette_mat...


Foutaises le deuxi?me lien.



abourick

1/17/2010 10:26:00 PM

0

lenel luc a ?crit :
> "abourick" <bourrique_anne@yahoo.br> a ?crit dans le message de news:
> C-KdnTk618Gw287WnZ2dnUVZ7vxi4p2d@giganews.com...
>
>> Le syst?me dictatorial existe depuis bien avant l'arriv?e des Duvalier.
>> Depuis l'ind?pendance de Ha?ti il n'a jamais cess?.
>
> "le remboursement des millions de francs-or vers?s ? la France pendant des
> d?cennies en ?change de la reconnaissance de l'ind?pendance. Cette somme
> r?actualis?e, a ?t? estim?e par le gouvernement ha?tien ? 21 milliard de
> dollars."
>
> http://www.lepost.fr/article/2010/01/15/1888988_la-france-a-une-dette-envers-haiti-de-plusieurs-mill...


La France s'est pay?e en grumes et je ne crois pas (c'est ? v?rifier)
per?u et de tr?s loin, tout ce qu'elle r?clamait. De plus le paiement
d'une dette n'a jamais emp?ch? l'instauration d'un r?gime d?mocratique.
Au lendemain de la d?faite de 1870 la France a ?t? saign?e aux quatre
veines par l'Allemagne, ce qui ne l'a pas emp?ch? d'?voluer vers un
r?gime r?publicain et d?mocratique.

D'Iberville

1/17/2010 11:36:00 PM

0

Le 2010-01-17 17:26, abourick a écrit :
> lenel luc a écrit :
>> "abourick" <bourrique_anne@yahoo.br> a écrit dans le message de news:
>> C-KdnTk618Gw287WnZ2dnUVZ7vxi4p2d@giganews.com...
>>
>>> Le système dictatorial existe depuis bien avant l'arrivée des
>>> Duvalier. Depuis l'indépendance de Haïti il n'a jamais cessé.
>>
>> "le remboursement des millions de francs-or versés à la France pendant
>> des décennies en échange de la reconnaissance de l'indépendance. Cette
>> somme réactualisée, a été estimée par le gouvernement haïtien à 21
>> milliard de dollars."
>>
>> http://www.lepost.fr/article/2010/01/15/1888988_la-france-a-une-dette-envers-haiti-de-plusieurs-mill...
>>
>
>
> La France s'est payée en grumes et je ne crois pas (c'est à vérifier)
> perçu et de très loin, tout ce qu'elle réclamait. De plus le paiement
> d'une dette n'a jamais empêché l'instauration d'un régime démocratique.
> Au lendemain de la défaite de 1870 la France a été saignée aux quatre
> veines par l'Allemagne, ce qui ne l'a pas empêché d'évoluer vers un
> régime républicain et démocratique.

Tous les pays du monde, et cela vaut même pour le Québec, ont dans leurs
cartons des créances "historiques" que leur devraient les uns ou les
autres. Des créances bien évidemment calculées de manière totalement
unilatérales, sur base de calculs aussi obscurs que fumeux. Des créances
qui ne sont bien entendu pas reconnues par les débiteurs invoqués,
lesquels, si on venait à les leur réclamer, s'empresseraient d'en
déduire d'autres créances, cette fois dues par le pays demandeur, et
calculées de manière tout aussi unilatérale.

Bref, la créance que détiendrait Haïti sur le monde en général, et le
monde occidental en particulier, est de la couille en boîte qui ne
fascine que les bobos et les tiermondistes...

--
Saviez-vous que... : http://diberville.blo...
Le blogue-notes de Diberville : http://diberville.livejo...
"Davon geht die Welt nicht unter, sieht man sie manchmal auch grau".