I've created a new class using prototype.js. After I make the
ajax.request all references to this.myClassMet hodorVariable are lost.
Does the ajax method blow out the object persistance? I'm fairly new to
OOP javascript so could be (and probably am) overlooking some detail.
Below is the logic of what i'm trying to do.
//Javascript code
var myClass = Class.create();
myClass.prototy pe={
initialize: function(fm) {
//Static Variables
this.myMessage = 'hello';
this.myName = 'Nick';
this.frm = fm;
this.WSURL = '/some/Server/script';
this.frm.onSubm it =
this.submitForm .bindAsEventLis tener(this);
},
submitForm: function(evt) {
var pars = myMessage;
var myAjax = new Ajax.Request( this.WSURL, { method: 'get',
parameters: pars, onSuccess: this.myHandler} );
},
myHandler: function(ajaxRe sponse) {
this.myMessage( ajaxResponse.re sponseText);
},
myMessage: function(str) {
alert(str);
}
};
//HTML Code
<form name="someForm" id="someForm" method="post" action="##">
<input type="text" id="myText" />
<input type="submit" name="submit" value="submit">
</form>
<script>var testClass = new myClass('somefo rm');</script> 45 3022 bi******@gmail. com said the following on 5/25/2006 2:03 PM: I've created a new class using prototype.js.
There above is 99.99999999% of your problem. Using a worthless piece of
junk script library.
After I make the ajax.request all references to this.myClassMet hodorVariable are lost.
Stop using prototype.js, you don't have an issue with it anymore.
Why do people come here asking for help with a specific library instead
of going to the inept programmer who wrote that library?
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
>>Why do people come here asking for help with a specific library instead
of going to the inept programmer who wrote that library?
wow that was a useful contribution to the programming community.
I know how about nobody develops any libraries and we all take 2 months
to accomplish what can be done in 2 days.
better yet, lets boycott javascript altogether, after all it was prolly
written by some inept programmer.
Dont get me wrong I still dont think this is the place to ask for help
with other libraries they should have there own group and if they dont
have one its pretty easy to make one. (thats what I did for
scriptaculous anyway)
But its not fair to call the programmers of thsoe libraries inept, its
usally the person using the control who is inept.
o0JoeCool0o wrote: Dont get me wrong I still dont think this is the place to ask for help with other libraries they should have there own group and if they dont have one its pretty easy to make one.
Most people here would agree.
Creating a js library using questionable programming techniques, then
providing very little documentation and no tech support seems kind of
anti-social, IMO.
But its not fair to call the programmers of thsoe libraries inept, its usally the person using the control who is inept.
I think inept is a bit much. Clearly, the author of prototype.js has
technical knowledge and skills far beyond most js coders.
I think 'misguided' may be a better term.
But then, different people would apply that label to almost anyone, myself
included ;)
--
Matt Kruse http://www.JavascriptToolbox.com http://www.AjaxToolbox.com
o0JoeCool0o said the following on 5/25/2006 3:39 PM: Why do people come here asking for help with a specific library instead of going to the inept programmer who wrote that library? wow that was a useful contribution to the programming community.
Programming community? This is Usenet. Its a discussion group, nothing
more and nothing less.
I know how about nobody develops any libraries and we all take 2 months to accomplish what can be done in 2 days.
If you are that inept, have at it.
better yet, lets boycott javascript altogether, after all it was prolly written by some inept programmer.
Probably so. But I bet they can spell probably.
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
o0JoeCool0o said the following on 5/25/2006 3:48 PM:
Don't get me wrong, but, I think people who repeatedly don't quote what
they are replying to are beyond inept. Dont get me wrong I still dont think this is the place to ask for help with other libraries they should have there own group and if they dont have one its pretty easy to make one. (thats what I did for scriptaculous anyway)
That is part of what makes them inept.
inept - lacking sense or reason : FOOLISH
And anybody that creates code such as prototype.js with it's complexity
without supporting it or even documenting it is, guess what? Inept.
But its not fair to call the programmers of thsoe libraries inept, its usally the person using the control who is inept.
That may be true also. But I doubt it. The same can be said for eval.
eval itself may or may not be evil, its just the person using it, right?
Well, anybody that understands the problems/drawbacks of eval enough to
know when to use doesn't use it. Same with prototype.js. If the
programmer understands enough to wade through that code to determine
what it does can write there own in less time and have the added benefit
of knowing exactly what it is doing.
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
o0JoeCool0o wrote: But its not fair to call the programmers of thsoe libraries inept, its usally the person using the control who is inept.
In this case (Prototype) it is. For it has been shown here that its author
ignored existing language features in favor of a newly invented wheel that
does not run with carriages that are little older than that he rode on, and
there are many examples on how to do much better than that.
PointedEars
Thomas 'PointedEars' Lahn wrote: o0JoeCool0o wrote:
But its not fair to call the programmers of thsoe libraries inept, its usally the person using the control who is inept.
In this case (Prototype) it is. For it has been shown here that its author ignored existing language features in favor of a newly invented wheel that does not run with carriages that are little older than that he rode on, and there are many examples on how to do much better than that.
Expect to see it more as the popularity of Ruby on Rails grows. This
framework is tied closely to Prototype.js.
There appears to be plenty of documentation at http://www.sergiopereira.com/articles/prototype.js.html, might be a good
place to send people who ask here.
--
Ian Collins.
Randy Webb wrote: The same can be said for eval. eval itself may or may not be evil, its just the person using it, right? Well, anybody that understands the problems/drawbacks of eval enough to know when to use doesn't use it.
That last sentence seems to mean the the knowledgable don't ever use
eval. Doesn't JSON absolutely require the use of at least one eval? I
don't mean this to be nit picking. I'm curious if there is another way
to deal with a JSON response or if you think those using JSON should be
doing something else?
Peter This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Michael.McD |
last post by:
Is there any consensus on the way to go when implementing object persistance
to a dB?
For example MHibernate v. DataObjects (x-tensive).
Cheers,
Michael McD
|
by: Florian Loitsch |
last post by:
hi,
in section 10.1.8 (Arguments Object) it is stated that the "internal
] property of the arguments object is the orginal Object
prototype object, the one that is the *initial* value of
Object.prototype".
Furthermore the Object.prototype property has attributes .
My question now: what does the "initial" refer to? To the untouched
prototype-object, or to the current Object.prototype? In the latter case:
why would the write "initial", if...
|
by: Elf M. Sternberg |
last post by:
One of the complaints about prototype.js (google for it if you're not
familiar with it) is that it's poorly documented. I have this inkling
that the key to understanding prototype.js is in the bind function.
The problem with Javascript is that the "this" operator is poorly
overloaded and it is often hard to understand in the context of
object-oriented javascript
So, let's start with the definition:
|
by: Robert |
last post by:
Hi,
I can use "with" like this:
function MyObject(message)
{
this.message = message;
}
function _MyObject_speak()
{
|
by: stephane |
last post by:
Hi all,
What I am trying to achieve is an 'inherits' method similar to Douglas
Crockford's (http://www.crockford.com/javascript/inheritance.html) but
that can enable access to the superclass' priviledged methods also. Do
you know if this is possible ?
In the following example, I create an ObjectA (variable a), an ObjectB
which inherits ObjectA (variable b) and an ObjectC which inherits
ObjectA (variable c1). The 'toString ()' method...
| |
by: lkrubner |
last post by:
I'm reading an essay, I think one of Crockford's, and it has this
example in it:
function Demo() { }
Demo.prototype = new Ancestor();
Demo.prototype.foo = function () { } ;
Does Ancestor now have a function called foo?
What if I have 5 different objects, all descended from Ancestor? Do
|
by: eman1000 |
last post by:
I was recently looking at the prototype library
(http://prototype.conio.net/) and I noticed the author used the
following syntax:
Object.extend(MyObj.prototype, {
my_meth1: function(){},
my_meth2: function(){}
});
to define new methods on the MyObj prototype object. Object.extend
|
by: Daz |
last post by:
Hi everyone.
My query is very straight forward (I think).
What's the difference between
someFunc.blah = function(){ ; }
and
|
by: jacobstr |
last post by:
I've noticed Object.extend used in a few different ways and I'm having
trouble distinguishing why certain usages apply to a given situation.
On line 804 Ajax.Base is defined as follows:
Ajax.Base = function() {};
Ajax.Base.prototype = {
setOptions: function(options) { <...>
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |