On 09/03/07, Rick Faircloth <[EMAIL PROTECTED]> wrote:
> Well.. thanks to everyone's help, especially yours, David,
> I've finally got a perfectly working solution that is based on
> your solution, David.  Thanks to Jorn and Sam, too!
>
> (Just a note:  I've still got one problem to solve.  When a form field has
> been left empty and the error message appears, a user can still click
> the "Calculate" button and submit the form, which causes a ColdFusion
> error due to the lack of the data to make the payment calculation.  How
> can I render the button "invalid" or unclickable if there's an error
> showing?)
>
> You can see the finished work at http://bodaford.whitestonemedia.com
> Click on a photo on the home page to go to the Featured Properties page.
> Scroll down until you see the "Click here to Calculate Mortgage." line.
> Then you should see the form.
>
> Here's the way I had to modify the code for the plug-in:
>
> errorPlacement: function(error, element) {
>
>         if(element.attr('id') == "Principal") {
>            error.appendTo("#principal_error");
>                 }
>
>         else
>
>         if(element.attr('id') == "Interest") {
>            error.appendTo("#interest_error");
>         }
>
>         else
>
>         if(element.attr('id') == "Years") {
>            error.appendTo("#years_error");
>         }
>     },

A more generic way:

errorPlacement: function(error, element) {

          error.appendTo("#" + element.attr('id') + "_error");
   },


Slight change in HTML:

<td></td><td id="Principal_error"></td>

Doing it this way will mean you don't have to edit your JavaScript for
the error placement if more fields are added.

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

Reply via email to