O'Reilly Forums: Problem Of Using Dom In Ch.7 Form Validation - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Problem Of Using Dom In Ch.7 Form Validation

#1 User is offline   pinkfloyd 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 26-May 12

Posted 26 May 2012 - 07:49 PM

I tried to use DOM instead of innerHTML in the example of Ch.7.
The validation for each input field works fine, but when it comes to the "place order" it failed.

Looks like the problem is DOM... since it's the only thing I did different from the example.

Can anybody tell me why this won't work and share what's the best practice for this situation?

Please find my file in attachment.

Attached File(s)


0

#2 User is offline   drewdin 

  • Super Veteran Member
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 608
  • Joined: 11-February 10
  • Gender:Male
  • Location:Boston

Posted 27 May 2012 - 08:19 AM

View Postpinkfloyd, on 26 May 2012 - 07:49 PM, said:

I tried to use DOM instead of innerHTML in the example of Ch.7.
The validation for each input field works fine, but when it comes to the "place order" it failed.

Looks like the problem is DOM... since it's the only thing I did different from the example.

Can anybody tell me why this won't work and share what's the best practice for this situation?

Please find my file in attachment.


using firebug i get that helpText on Line 24 is undefined. I'm guessing it has to do with the scope of the variable but I am no Javascript master. Maybe Lemuel could explain better.

Heres line 24:
while (helpText.firstChild){

0

#3 User is offline   drewdin 

  • Super Veteran Member
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 608
  • Joined: 11-February 10
  • Gender:Male
  • Location:Boston

Posted 30 May 2012 - 11:28 AM

 lemuel, on 28 May 2012 - 09:02 AM, said:

The object
form["message_help"]

doesn't exist: there is no field with the *name* "message_help". Change this:
<span id="message_help" class="help"></span>

to this:
<span id="message_help" name="message_help" class="help"></span>

etc.


Good catch lemuel, I feel like I should have caught that when i got the undefined error in firebug but i didnt put the time in. I hope the OP reads this
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users