After some prolonged testing I made this work...

If I define a class as following:

        classDef("MyClass", { ...

then it works...I believe I traced the error to Runtime.js class which
defines classDef method.
In that class it splits the first param using a  dot and creates an object
out of each word.
So in case of "mycompany.dialog.MyClass" it should create 3 objects but it
seems not to....


I also tried changing

        saveOnclick             mycompany.dialog.MyClass.validate()
 

Which produced valid JS call but then it complained that "mycompany" was
undefined....
So back to Runtime.js....I guess


Thanks
 
Amir

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 12, 2007 2:30 PM
To: [email protected]
Subject: [magnolia-user] saveOnclick - class not found

Hi all

I am trying to use saveOnclick feature to validate my dialogs.
So I added following node to my dialog (which is used in Page Properties
paragraph)


        saveOnclick             MyClass.validate()



Then I created under

        WEB-INF\classes\mgnl-resources\js-classes\mycompany\dialog

a file called MyClass.js which looks like this:


classDef("mycompany.dialog.MyClass", {
    validate: function (){
        var value = document.mgnlFormMain.title.value;

        if(value.length > 10){
            alert("Title too long");
            return false;
        } else {
                  mgnlDialogFormSubmit();
        }

    }
});




However I cannot get this to work...
When I click Save button on my dialog nothing happens....

I used Firebug in Firefox and I am getting an error "MyClass is not defined
(onclick click clientX=0,clientY=0)"

And the file referenced is page-propetries.html




Any ideas...Seems like a Prototype guru (which I am not) would be able to
figure this one out fairly quickly...


Thanks
Amir




----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------


----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------

Reply via email to