On 15/03/07, Rick Faircloth <[EMAIL PROTECTED]> wrote:
> Well, Daemach...seems I've got things working well with
> my jQuery client side data-handling and CF server side validation.
>
> My next step is to submit the form data and process it via CF
> and return the result. I've got the jQ code and CF for that for the
> most part. Here's my jQ Mortgage Calculation code:
>
> function CalculateMortgage(){
>
> var Params = {};
>
> $("input:text").each(function(){
> Params[$(this).attr("name")] = $(this).val();
> });
>
> $.post("Mortgage_Calculation.cfm", Params, function(data){
>
> $("#Result").empty().append(data);
>
> }
> );
> }
>
> This should still work fine, but I need to know how I can notify
> CF that it's time to process all the data, not validate it.
>
> What can I use for that? Typically, I would put together some CF code
> that said "If form.principal is defined, then validate the code. If there
> are
> no errors, then process the code and calculate the result."
>
> However in this case, the form.principal is being sent everytime there's
> on onblur event, so that won't work.
>
> I can't rely on a submit button value for triggering the calculation, since
> if someone hits the enter key instead of click the submit button, the submit
> button value won't be present.
>
> I may be over-complicating this...got any clues?
>
> Thanks,
>
> Rick
You could intercept it when enter is pressed:
$("input:text").bind("keypress",function(e) {
var key = e.keyCode || e.charCode;
if(key == 13) {
CalculateMortgage();
}
}
)
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/