[Proto-Scripty] Re: element is null suggestion

2010-09-10 Thread Blaine
Brian:

I missed the point that it was changing your supplied reference, as
opposed to just returning null.  I agree: that's nasty.

On Sep 9, 6:03 pm, Brian Marquis br...@quotepro.com wrote:
 Blaine,

 It's not my code...

 I'm trying to debug other people's work, it's rather irritating when I'm
 getting a null pointer exception from code returned via an Ajax call and run
 via executeScripts.

 I'm not asking to change the behavior or somehow trap the null value and
 return something else. Just asking for the incoming parameters to be
 preserved. Hmm, I wonder if the original value would still be in the
 arguments array???

 -Original Message-
 From: prototype-scriptaculous@googlegroups.com

 [mailto:prototype-scriptacul...@googlegroups.com] On Behalf Of Blaine
 Sent: Thursday, September 09, 2010 1:29 PM
 To: Prototype  script.aculo.us
 Subject: [Proto-Scripty] Re: element is null suggestion

 I think the way it is is intuitive to JavaScript developers who know
 Document.getElementById().  If the element may return null, then check
 for null dammit ;-) ... just as if you were coding directly with w3c
 API.

 WRT console logging, there are tons of places where console logging
 would be useful in Proto, but for whatever reason, it's been decided
 to avoid any dependency on a console device.  I very much doubt that
 this use case is going to overturn that policy.

 On Sep 8, 12:01 pm, Brian Marquis br...@quotepro.com wrote:
  In numerous places throughout the Prototype library, the element
  parameter is extended and overwritten. This code typically resembles
  the following code:

  someMethod: function(element) {
    element = $(element);
    return element.someOtherMethod();

  }

  For me, at least, this makes debugging more difficult than it could
  be. Consider the following modification

  someMethod: function(desiredElement) {
    element = $(desiredElement);
    return element.someOtherMethod();

  }

  Now I can place a Breakpoint on Error in Firebug and instantly know
  which element is causing the problem. Or perhaps even better would be
  a modification to perform console logging if $(element) would return
  null.

 --
 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-scriptacul...@googlegroups.com.
 To unsubscribe from this group, send email to
 prototype-scriptaculous+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/prototype-scriptaculous?hl=en.

-- 
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-scriptacul...@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] Re: element is null suggestion

2010-09-09 Thread Blaine
I think the way it is is intuitive to JavaScript developers who know
Document.getElementById().  If the element may return null, then check
for null dammit ;-) ... just as if you were coding directly with w3c
API.

WRT console logging, there are tons of places where console logging
would be useful in Proto, but for whatever reason, it's been decided
to avoid any dependency on a console device.  I very much doubt that
this use case is going to overturn that policy.


On Sep 8, 12:01 pm, Brian Marquis br...@quotepro.com wrote:
 In numerous places throughout the Prototype library, the element
 parameter is extended and overwritten. This code typically resembles
 the following code:

 someMethod: function(element) {
   element = $(element);
   return element.someOtherMethod();

 }

 For me, at least, this makes debugging more difficult than it could
 be. Consider the following modification

 someMethod: function(desiredElement) {
   element = $(desiredElement);
   return element.someOtherMethod();

 }

 Now I can place a Breakpoint on Error in Firebug and instantly know
 which element is causing the problem. Or perhaps even better would be
 a modification to perform console logging if $(element) would return
 null.

-- 
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-scriptacul...@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.



RE: [Proto-Scripty] Re: element is null suggestion

2010-09-09 Thread Brian Marquis
Blaine,

It's not my code...

I'm trying to debug other people's work, it's rather irritating when I'm
getting a null pointer exception from code returned via an Ajax call and run
via executeScripts.

I'm not asking to change the behavior or somehow trap the null value and
return something else. Just asking for the incoming parameters to be
preserved. Hmm, I wonder if the original value would still be in the
arguments array???



-Original Message-
From: prototype-scriptaculous@googlegroups.com
[mailto:prototype-scriptacul...@googlegroups.com] On Behalf Of Blaine
Sent: Thursday, September 09, 2010 1:29 PM
To: Prototype  script.aculo.us
Subject: [Proto-Scripty] Re: element is null suggestion

I think the way it is is intuitive to JavaScript developers who know
Document.getElementById().  If the element may return null, then check
for null dammit ;-) ... just as if you were coding directly with w3c
API.

WRT console logging, there are tons of places where console logging
would be useful in Proto, but for whatever reason, it's been decided
to avoid any dependency on a console device.  I very much doubt that
this use case is going to overturn that policy.


On Sep 8, 12:01 pm, Brian Marquis br...@quotepro.com wrote:
 In numerous places throughout the Prototype library, the element
 parameter is extended and overwritten. This code typically resembles
 the following code:

 someMethod: function(element) {
   element = $(element);
   return element.someOtherMethod();

 }

 For me, at least, this makes debugging more difficult than it could
 be. Consider the following modification

 someMethod: function(desiredElement) {
   element = $(desiredElement);
   return element.someOtherMethod();

 }

 Now I can place a Breakpoint on Error in Firebug and instantly know
 which element is causing the problem. Or perhaps even better would be
 a modification to perform console logging if $(element) would return
 null.

-- 
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-scriptacul...@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.


-- 
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-scriptacul...@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] Re: element is null suggestion

2010-09-09 Thread T.J. Crowder
Hi,

 Hmm, I wonder if the original value would still be in the
 arguments array???

Nope. `arguments` is *that* magic. If you have, say:

function foo(bar)

...then `bar` is an alias for `arguments[0]` and vice-versa. Writing
to `bar` updates `arguments[0]` and writing to `arguments[0]` updates
`bar`. Example: http://jsbin.com/ojomu
--
T.J. Crowder
Independent Software Engineer
mail: tj / crowder software / com
web: www / crowder software / com

On Sep 9, 11:03 pm, Brian Marquis br...@quotepro.com wrote:
 Blaine,

 It's not my code...

 I'm trying to debug other people's work, it's rather irritating when I'm
 getting a null pointer exception from code returned via an Ajax call and run
 via executeScripts.

 I'm not asking to change the behavior or somehow trap the null value and
 return something else. Just asking for the incoming parameters to be
 preserved. Hmm, I wonder if the original value would still be in the
 arguments array???



 -Original Message-
 From: prototype-scriptaculous@googlegroups.com

 [mailto:prototype-scriptacul...@googlegroups.com] On Behalf Of Blaine
 Sent: Thursday, September 09, 2010 1:29 PM
 To: Prototype  script.aculo.us
 Subject: [Proto-Scripty] Re: element is null suggestion

 I think the way it is is intuitive to JavaScript developers who know
 Document.getElementById().  If the element may return null, then check
 for null dammit ;-) ... just as if you were coding directly with w3c
 API.

 WRT console logging, there are tons of places where console logging
 would be useful in Proto, but for whatever reason, it's been decided
 to avoid any dependency on a console device.  I very much doubt that
 this use case is going to overturn that policy.

 On Sep 8, 12:01 pm, Brian Marquis br...@quotepro.com wrote:
  In numerous places throughout the Prototype library, the element
  parameter is extended and overwritten. This code typically resembles
  the following code:

  someMethod: function(element) {
    element = $(element);
    return element.someOtherMethod();

  }

  For me, at least, this makes debugging more difficult than it could
  be. Consider the following modification

  someMethod: function(desiredElement) {
    element = $(desiredElement);
    return element.someOtherMethod();

  }

  Now I can place a Breakpoint on Error in Firebug and instantly know
  which element is causing the problem. Or perhaps even better would be
  a modification to perform console logging if $(element) would return
  null.

 --
 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-scriptacul...@googlegroups.com.
 To unsubscribe from this group, send email to
 prototype-scriptaculous+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/prototype-scriptaculous?hl=en.

-- 
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-scriptacul...@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] Re: element is null error on Draggable - element exists!

2009-06-16 Thread Rick Waldron
Could you set this up on http://jsbin.com/?




On Tue, Jun 16, 2009 at 2:06 PM, adamski adam.elemen...@gmail.com wrote:


 I'm having some trouble getting a Draggable to dorp onto a Droppable.
 I get the old element is null error from prototype (its trying to
 show an non-existent element).

 However, the element being dragged most definitely exists, as does the
 droppable. JS generated form Rails helpers.

 Any help much appreciated.

  Funny thing is I have just got another page on our app working really
 well with draggables and droppables. I did notice an element is null
 error on that page but it seems not to affect its functionality.

 Code excerpt is below, hope its not too long to skim through.



  div id=release-search-results-panel
div
 id=card-search-results

div style=position: relative; id=card_Issue_297 class=entity-
 search-card level1

span style=display: none; id=Issue_297_arrow
  img id=Issue_297_expanded onclick=javascript: return
 toggleWallSearchTree(297, 'Issue',false); return false; src=/images/
 icons/arrow_down.gif style=display: none; cursor: pointer;
  img id=Issue_297_collapsed onclick=javascript: return
 toggleWallSearchTree( 297,'Issue',false);return false; src=/images/
 icons/arrow_up.gif style=display: inline; cursor: pointer;
img id=loading_Issue_297
 src=/images/indicator.gif
 style=display: none;
/span
span id=Issue297_loading style=display: none;
 class=clearfix

  img src=/images/small-loading.gif
/span
I1 : test KPI

/div
script type=text/javascript
 //![CDATA[
 new Draggable(card_Issue_297, {revert:true})
 //]]
 /script

!-- IMPORTANT: span MUST be empty for JS/Ajax to work --
span id=Issue_297_children class=child-container/span

div style=position: relative; id=card_Issue_298 class=entity-
 search-card level1

span style=display: none; id=Issue_298_arrow

  img id=Issue_298_expanded onclick=javascript: return
 toggleWallSearchTree(298, 'Issue',false); return false; src=/images/
 icons/arrow_down.gif style=display: none; cursor: pointer;
  img id=Issue_298_collapsed onclick=javascript: return
 toggleWallSearchTree( 298,'Issue',false);return false; src=/images/
 icons/arrow_up.gif style=display: inline; cursor: pointer;
img id=loading_Issue_298
 src=/images/indicator.gif
 style=display: none;
/span
span id=Issue298_loading style=display: none;
 class=clearfix
  img src=/images/small-loading.gif
/span
I2 : there is an issue here

/div
script type=text/javascript
 //![CDATA[
 new Draggable(card_Issue_298, {revert:true})
 //]]
 /script

div style=position: relative;
 id=release-iterations-panel
preleases/iterations../p
/div
script type=text/javascript
 //![CDATA[
 Droppables.add(release-iterations-panel, {after_effect:Element.hide,
 before_effect:Element.show, onDrop:function(element){Element.show
 ('indicator'); new Ajax.Request('/releases/add_item',
 {asynchronous:true, evalScripts:true, onComplete:function(request)
 {Element.hide('indicator')}, parameters:'id=' + encodeURIComponent
 (element.id) + 'authenticity_token=' + encodeURIComponent
 ('acaa102f216e113331509e9d9e7ef3c6418267e7')})}})
 //]]
 /script


 


--~--~-~--~~~---~--~~
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] 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
-~--~~~~--~~--~--~---