[Proto-Scripty] Re: Element is null

2009-01-22 Thread n8cshaw

A good night's rest made me see that I did not have an id attribute on
the form element, just a name. My bad. That gets me sometimes when I
am referencing form fields.

By the way, the code is actually velocity, a little-known java
template language. It was part of a project we ended up using a few
years back and now we are stuck with it.


On Jan 22, 3:18 am, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

  The line:

  Event.observe('$formName', 'submit', checkReqFields, false);

  is causing...

 In the code you quoted, that line doesn't exist; this does:

      Event.observe('fm', 'submit', checkReqFields, false);

 I assumed at first that you were quoting the end result that went to
 the browser rather than the PHP source code, but then noticed that
 further down in the function you quoted, you _do_ have PHP source
 code, which made me wonder...  Did you accidentally replace $formName
 with fm in your source, and are you now running with a different form
 name?  Not likely, but just checking.

 If not that:  You're sure that fm is the _ID_ of the form?  E.g.,
 form id='fm', not (for example) form name='fm'?

 If that's not it, to continue troubleshooting, I'd suggest picking up
 with #3 on this list:http://proto-scripty.wikidot.com/faq#xyzprob

 (BTW, if you're using 1.6, Event#observe no longer has the fourth
 parameter.)

 FWIW  HTH,
 --
 T.J. Crowder
 tj / crowder software / com
 Independent Software Engineer, consulting services available

 On Jan 21, 9:14 pm, n8cshaw n8cs...@gmail.com wrote:

  I am doing the following on one of my pages:

  document.observe(dom:loaded, function() {
      Event.observe('fm', 'submit', checkReqFields, false);
      $('resetBtn').observe('click',resetForm);

      #if(!$edit)
        initForm();
      #else
        disableOther();
      #end
    });

  The line:

  Event.observe('$formName', 'submit', checkReqFields, false);

  is causing an element is null error on page load. If I remove that
  line, I don't get the error. The form that is referenced exists, the
  function checkReqFields exists and the script is located after the
  HTML, so all of the elements should exist before it is executed.

  I do something very similar on another page and it works fine. Any
  ideas as to what is causing this problem?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Element is null

2009-01-21 Thread n8cshaw

I am doing the following on one of my pages:

document.observe(dom:loaded, function() {
Event.observe('fm', 'submit', checkReqFields, false);
$('resetBtn').observe('click',resetForm);

#if(!$edit)
  initForm();
#else
  disableOther();
#end
  });

The line:

Event.observe('$formName', 'submit', checkReqFields, false);

is causing an element is null error on page load. If I remove that
line, I don't get the error. The form that is referenced exists, the
function checkReqFields exists and the script is located after the
HTML, so all of the elements should exist before it is executed.

I do something very similar on another page and it works fine. Any
ideas as to what is causing this problem?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---