OK, so I gave up on the Spry version of the database validation and moved onto 
AJAX (a language I really don't know a lot about but I am slowly figuring it 
out). Anyway, I have the code working the way I want with the exception that 
when the validation is done, whether the code is valid or not, the page is 
reloading and showing an overlay or something of the page. If you go to 
http://www.makeaherodonations.com/themovement/ you'll see what I am talking 
about. It's weird and I have been trying to figure this out. Here is the script:

<script src="js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
pic1 = new Image(16, 16); 
pic1.src = "images/loader.gif";

$(document).ready(function(){

$("#orgname").change(function() { 

var usr = $("#orgname").val();

if(usr.length >= 2)
{
$("#status").html('<img align="absmiddle" src="images/loader.gif" /> Checking 
Code...');

$.ajax({ 
type: "POST", 
url: "checkcode.cfm", 
data: "orgname="+ usr, 
success: function(msg){ 

$("#status").ajaxComplete(function(event, request, settings){ 

if(msg == 'OK')
{ 
$("#orgname").removeClass('object_error'); // if necessary
$("#orgname").addClass("object_ok");
$(this).html(' <img align="absmiddle" src="images/accepted.png" /> ');
} 
else 
{ 
$("#orgname").removeClass('object_ok'); // if necessary
$("#orgname").addClass("object_error");
$(this).html(msg);
}});}});}
else
{
$("#status").html('The Code should have at least 2 characters.');
$("#orgname").removeClass('object_ok'); // if necessary
$("#orgname").addClass("object_error");
}});});

//-->

</script>

I think that I'll have to head to the bookstore tomorrow and get me an AJAX 
book. It seems pretty cool and something that I can use in the future.

Bruce

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353590
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to