-2

I am trying to deduce why this method in my href does not work. It returns a javascript error :

<form name="mutate" method="post" action="index.php?a=24">
  <a href="#" onclick="documentDirty=false; document.mutate.save.click();saveWait('mutate');">

The error is document.mutate.save is undefined

Fair enough. But I want to figure out why, and then define it.

What is the best way for me to trace the source of this error?

Trip
  • 26,756
  • 46
  • 158
  • 277
  • show your javascript pls – Laurence Burke Oct 19 '11 at 15:37
  • 1
    I think a lot more code is needed to answer this question, since `document.mutate` isn't exactly BOM-standard. – Richard JP Le Guen Oct 19 '11 at 15:38
  • 1
    Seems like you're using [MODX](http://www.modx.com/). [This thread](http://forums.modx.com/thread/32982/javscript-error-of-quot-document-mutate-save-is-undefined-quot) suggests you have upgraded it and the upgrade went wrong. [Google is your friend](http://www.google.com/search?q=document.mutate.save+is+undefined)... – DaveRandom Oct 19 '11 at 15:40
  • @Dave , yah I saw that thread and commented at the bottom of it. – Trip Oct 19 '11 at 15:41
  • @LaurenceBurke There's quite a few javascript files that ModX uses. I'm not exactly sure what I should even be looking for.. – Trip Oct 19 '11 at 15:45
  • 2
    @Neal indeed, although LMGTFY is very, very, very frowned upon here (as is JFGI) – DaveRandom Oct 19 '11 at 15:45
  • 1
    @DaveRandom Im am not sure that is true. – Naftali Oct 19 '11 at 15:46
  • @Neal I say that because I posted one once and was showered with a hate storm from all sides... – DaveRandom Oct 19 '11 at 16:00
  • What snippet you use? i never saw form like that in Modx Evo. Or do you mean you're editing the back end manager? – GusDeCooL Dec 20 '11 at 08:01

1 Answers1

0

document.mutate refers to the form element you are working in (<form name="mutate"...>)

I'd assume that document.mutate.save refers to a button named save somewhere in the form.

The error is telling you that the button does not exist.

Brian Driscoll
  • 19,373
  • 3
  • 46
  • 65
  • Sure, thank you. Isn't that technically what I have written in my question? – Trip Oct 19 '11 at 15:43
  • Well, it seemed as though you didn't know what was causing the error. I also didn't notice the `modx` tag however, so given that you're using a CMS all bets are off as to where the HTML is generated for that button. – Brian Driscoll Oct 19 '11 at 15:44
  • Ah, thank you. I do know where the file is that is creating that button. I have that located. document(is raw js).mutate( is something that ModX is responsible for.. ). So I assume that what is occuring here is `.mutate` is not being defined and frontloaded properly. ModX uses mooTools, but I checked the mootools and this isn't a function. So I assume its Modx..and I can't find any definition of it anywhere in any of the files.. – Trip Oct 19 '11 at 15:51