It working well, Daemach!

I've just got to tweak my Regex's to provide better validation
statements in ColdFusion.

Mine aren't quite proper for the Interest Rate (need digits and periods
only)
and for years (need digits only).

Ajax is quite exciting to be able to send data for processing with
refreshing the page!
I see a *lot* of possibilities well beyond just validating, such as using
form fields
for querying against data, etc.

Once I get the principles of how jQuery works and the syntax to implement,
I'll be off and running!

Thanks for your help!

Rick

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Daemach
Sent: Thursday, March 15, 2007 10:29 AM
To: discuss@jquery.com
Subject: Re: [jQuery] Ok... one last effort to make this work... help!


In this case you are handling each of the  results differently so you could
do it by putting anonymous functions directly in the post callbacks like
this: 

$(document).ready(function(){

        $("#Principal").blur(function(){ 
        $.post("callpage_Validate_Mortgage_Inputs.cfm",
{principal:$("#Principal").val()}, function (data)
{$("#Result_Principal").empty().append(data) } ) });
        
        $("#Interest").blur(function(){

$.post("callpage_Validate_Mortgage_Inputs.cfm",{interest:$("#Interest").val(
)},
function (data) {$("#Result_Interest").empty().append(data) }) });
        
        $("#Years").blur(function(){
        
$.post("callpage_Validate_Mortgage_Inputs.cfm",{years:$("#Years").val()},
function (data) {$("#Result_Years").empty().append(data) }) });
        
});

OR you could pass the target div to an outside function like this:

$(document).ready(function(){

        $("#Principal").blur(function(){ 
        $.post("callpage_Validate_Mortgage_Inputs.cfm",
{principal:$("#Principal").val()}, function (data) {
handleCallback("Principal",data); }) });
        
        $("#Interest").blur(function(){

$.post("callpage_Validate_Mortgage_Inputs.cfm",{interest:$("#Interest").val(
)},
function (data) { handleCallback("Interest",data); }) });
        
        $("#Years").blur(function(){
        
$.post("callpage_Validate_Mortgage_Inputs.cfm",{years:$("#Years").val()},
function (data) { handleCallback("Years",data); }) });
        
});

function handleCallback(target,data) {
        $("#Result_" + target).empty().append(data);
}

In general you should avoid creating outside functions inside the
document.ready function for cleanliness if nothing else.



Rick Faircloth wrote:
> 
> Hi, Daemach...
> 
> I've been working with the various suggestions I've gotten and
> have made some progress.  I had to spend most of yesterday
> trying to figure out why my computer wouldn't boot.  Finally
> isolated a software problem with a virtual CD emulator.  Deleted
> that and all is well.
> 
> Now with my code...
> 
> The outcome I'm looking for now is to have the error message appear
> above each form field.  Here's an online demo of what's happening:
> 
> http://bodaford.whitestonemedia.com/html/trial_field_validation.cfm
> 
> I get duplicate error messages and in the wrong spots...
> I don't know how to combine the elements to make
> them function properly.  Any ideas?
> 
> Thanks!
> 
> Rick
> 
> Here's the code...
> 
> <script type="text/javascript">
> 
>       $(document).ready(function(){
> 
>               $("#Principal").blur(function(){ 
>               $.post("callpage_Validate_Mortgage_Inputs.cfm",
> {principal:$("#Principal").val()}, handleCallback) });
>               
>               $("#Interest").blur(function(){
>       
>
$.post("callpage_Validate_Mortgage_Inputs.cfm",{interest:$("#Interest").val(
> )}, handleCallback) });
>               
>               $("#Years").blur(function(){
>       
> $.post("callpage_Validate_Mortgage_Inputs.cfm",{years:$("#Years").val()},
> handleCallback) });
>               
>               function handleCallback(data) {
>       
> $("#Result_Principal").empty().appendTo("#Result_Principal").append(data);
>       
> $("#Result_Interest").empty().appendTo("#Result_Interest").append(data);
>       
> $("#Result_Years").empty().appentTo("#Result_Years").append(data);
> 
>               }
>                               
>       });
> 
>       
> 
> </script>
> 
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Daemach
> Sent: Thursday, March 15, 2007 12:26 AM
> To: discuss@jquery.com
> Subject: Re: [jQuery] Ok... one last effort to make this work... help!
> 
> 
> Did you get this working Rick?
> 
> 
> 
> 
> 
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context:
http://www.nabble.com/Ok...-one-last-effort-to-make-this-work...-help%21-tf3
399722.html#a9495623
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to