simple async post back example

  • Thread starter Yankee Imperialist Dog
  • Start date
Y

Yankee Imperialist Dog

I need to do a simple asych post back to validate that an id is unique. I do
not want to post back the entire page for this, but i want to make this part
of the clientside validators.

1. i already have a custom validator that checks for a correctly formatted
id and the javascript works w/o problem.

Any help would be appreciated.
 
B

bruce barker

async postback is incompatiable with validators. validatiors are called to
cancel a postback, they can not wait around for the async return.

you could use an update panel, but this is really a full postback and page
process.

-- bruce (sqlwork.com)
 
Y

Yankee Imperialist Dog

thanks for replying,
(I think my description was off.)

I gues that's the point i want the validator to cancel the post back.
i have a customvalidator that uses the following script
<script language="JavaScript">
<!--
function CheckTrepID(sender, args)
{
var TrpID = args.Value;
var alphs = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var nums = '0123456789';
if (TrpID.length != 10)
{
args.IsValid = false;
return;
}

for (var i=0;i<3; i++)
if ( alphs.indexOf(TrpID.charAt(i)) == -1)
{
args.IsValid = false;
return;
}
for (var i=3;i<11; i++)
if ( nums.indexOf(TrpID.charAt(i)) == -1)
{
args.IsValid = false;
return;
}
args.IsValid = true;
}
// -->
</script>

What i'd like to do is if the script see's that the new Trpid is correctly
formatted. to call a webservice with that Trpid and have the web service
return a bool saying if it exists. There has to be a way to do this. I just
can't find a simple example of how to do this.

Thanks
KES
 
B

bruce barker

you would need to do a sync webservice call not an async one (or async
callback). see the ms ajax toolkit or the jquery toolkit.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top