Hi,

> That last line gives the error - should I do $(el).getAttribute
> ('validation')?
> I believe that I already extended it setting var el to $(elements[i]),
> or am I mistaking?

No, you're right, having done the extension once, you're all set.

> Is there a nicer way to create
> an array from this in stead of doing what I do with the eval function?

If I'm reading you right, you're going to end up eval'ing this string:

new Array({type:'required',
errorMessage:'Vereist Veld'} , {type:'minchars',
errorMessage:'Minimaal 2 karakters vereist', chars: '2'} ,
{type:'maxchars', errorMessage:'Maximaal 63 toegelaten', chars:
'63'} )

That's probably not going to have the intended effect.  I would
probably suggest:

validations = ('[' + el.getAttribute('validations') + ']').evalJSON();

...or better yet, have your server side output the brackets.  But is
that really the best way to pass the validations from server to
client?

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


On Aug 17, 5:58 pm, "speedpac...@gmail.com" <speedpac...@gmail.com>
wrote:
> Hi again,
>
> I tried modifying the code, but I'm still running into an error saying
> that "the property or method is not supported on this object".
>
> Code snippet as follows:
> ---
>     var elements = $(frm).select('[validation]');
>     alert(elements.length);
>     for(var i=0; i < elements.length; i++) {
>         var el = $(elements[i]);
>
>         // first add validations to the form...
>         validations = eval('new Array' + el.getAttribute
> ('validation'));
> ---
> That last line gives the error - should I do $(el).getAttribute
> ('validation')?
> I believe that I already extended it setting var el to $(elements[i]),
> or am I mistaking?
>
> Also - the attribute 'validation' is set to ({type:'required',
> errorMessage:'Vereist Veld'} , {type:'minchars',
> errorMessage:'Minimaal 2 karakters vereist', chars: '2'} ,
> {type:'maxchars', errorMessage:'Maximaal 63 toegelaten', chars:
> '63'} ), which is rendered serverside.  Is there a nicer way to create
> an array from this in stead of doing what I do with the eval function?
>
> Again - prototype rules, even for me not being a javascript guru :)
>
> David.
>
> On 17 aug, 18:04, "speedpac...@gmail.com" <speedpac...@gmail.com>
> wrote:
>
>
>
> > Wow!
> > thanks so much for the response.  I was under the impression that as
> > it was already passed to the function as an element and not the id
> > reference, it was already extended, but I just learned something new
> > then, so thanks for the incredibly fast response.
>
> > I have some other errors on IE, but I'll try to figure them out myself
> > as well.
>
> > Again - thanks for the great script and support through these groups!
>
> > David.
>
> > On 17 aug, 17:57, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
>
> > > Hi,
>
> > > You need to run your form reference through $(), e.g.:
>
> > > frm = $(frm);
>
> > > ...in order to get access to the extended methods provided by
> > > Prototype.  See this article[1] on the Prototype site for details.
>
> > > [1]http://prototypejs.org/learn/extensions
>
> > > HTH,
> > > --
> > > T.J. Crowder
> > > tj / crowder software / com
> > > Independent Software Engineer, consulting services available
>
> > > On Aug 17, 4:34 pm, "speedpac...@gmail.com" <speedpac...@gmail.com>
> > > wrote:
>
> > > > Hi,
>
> > > > I'm working on our new website, and I love prototypejs for it.
> > > > Unfortunately, I seem to be having an issue with Element.select when I
> > > > initialise my forms when the page is being opened in IE.
>
> > > > You can check the error 
> > > > onhttp://flexin.be/site/nl/Product/details/100011.html&_s=0
>
> > > > Unfortunately, I seem to be unable to fix the issue.  Does anyone have
> > > > any idea as to what might be causing this?
>
> > > > FF, as usual just loves the code and renders the page error-free.
>
> > > > Thanks a lot for your assistance!
> > > > David.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to