Google Groups Home
Help | Sign in
validating without onSubmit
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
nam5a  
View profile
 More options Jul 22, 4:16 pm
From: nam5a <nokomis.mccask...@gmail.com>
Date: Tue, 22 Jul 2008 13:16:10 -0700 (PDT)
Local: Tues, Jul 22 2008 4:16 pm
Subject: validating without onSubmit
This does not work. Can anyone help??? It says $(form) has no
properties

<script type="text/javascript">
...
function valid() {
return checker.validate();

}

  function process(form){

if (valid())
{
...

}

</script>
...
<form name='laura_namelist_data'>

  <script type="text/javascript">
    var checker = new Validation('laura_namelist_data',
{onSubmit:false});
  </script>
...
<input type ="button"
         value="write laura_namelist_data"
         onclick="process(this.form)"/>
</form>


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Wayne Leroux  
View profile
 More options Jul 22, 4:24 pm
From: Wayne Leroux <wayneler...@gmail.com>
Date: Tue, 22 Jul 2008 16:24:43 -0400
Local: Tues, Jul 22 2008 4:24 pm
Subject: Re: [Dexagogo] validating without onSubmit
Hey,

Move:

  <script type="text/javascript">
    var checker = new Validation('laura_namelist_data',
{onSubmit:false});
  </script>

AFTER the form

and change:

<form name='laura_namelist_data'>

to:

<form name='laura_namelist_data' id='laura_namelist_data'>

Personally... I rather have the validation code up in the head with  
the other javascript:

Event.observe( document, 'load', function(){
   new Validation('laura_namelist_data', {onSubmit: false});

});

Hope this helps,

- Wayne Leroux

On 22-Jul-08, at 4:16 PM, nam5a wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
peelman@gmail.com  
View profile
 More options Jul 23, 7:31 am
From: "peel...@gmail.com" <peel...@gmail.com>
Date: Wed, 23 Jul 2008 04:31:37 -0700 (PDT)
Local: Wed, Jul 23 2008 7:31 am
Subject: Re: validating without onSubmit
To expand on Wayne's answer:

Javascript runs off of id="" tags.  Names do it no good at all.
Technically you should be giving EVERY tag an ID that can carry one.
Anytime you want to manipulate a specific object with Javascript you
are going to refer to it by its ID.  Prototype allows you to do neat
things like grabbing all objects with a specific class, or
"navigating" the DOM tree by going up or down a level from an object,
but the safest and easiest way is to use ID tags, and that's what the
Validation framework requires to work properly, which is one reason
why you're getting that error.

Secondly, the reason the JS has to come AFTER the form is that when
the JS runs in your current code, the form doesn't exist yet.  The
browser will be throwing a silent error because you're trying to
attach Javascript to something that hasn't yet been rendered.  What
Wayne's code is doing is telling Javascript to wait until the page is
done loading (thereby the form WILL exist) THEN call/create the
validation, which works just as well and as he said lets you keep your
javascript all up in the head.  Personally I leave it at the bottom of
my form document so that it runs right after the form loads, since if
you wait on the rest of the page people could technically enter data
before the validation has started and submit the form, though this
depends heavily on how quickly the page loads.

Hope this helps some.

On Jul 22, 4:24 pm, Wayne Leroux <wayneler...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
nam5a  
View profile
 More options Jul 23, 9:20 am
From: nam5a <nokomis.mccask...@gmail.com>
Date: Wed, 23 Jul 2008 06:20:25 -0700 (PDT)
Local: Wed, Jul 23 2008 9:20 am
Subject: Re: validating without onSubmit
Thanks!!!

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google