hint hacks, playing with prototype

gg4j 12 Nov, 2007
Hi guys,

playing with forms thanks to CC on joomla now.

So, have a look at

http://www.askthecssguy.com/2007/03/form_field_hints_with_css_and.html


and look for the post of:
Posted October 1, 2007 12:19 AM | #
Markus said:


basically he plays around with prototypejs.js

that's the file js frame you use in Chronoforms.
He use even Low Pro Behaviours,
http://www.danwebb.net/2007/7/18/low-pro-behaviours-101-part-2
those I have no clue what they are😛

I'd like to improve CC buy copying the code in the prototypejs.js,
or smtg like that.

It would be nice to put this option (create hints) in smtg similar to "validation" fields in the admin of forms of CC.


Do you think it is possible?:side:
any idea of how to play around with your code and the code of Markus?



This will avoid to copy the js in the form field, keeping the builded page clean.
GreyHead 12 Nov, 2007
Hi gg4j,

Nice finds, 'Low Pro' looks like a neat Prototype extension. Would be good if you were to play with it.

The problems with putting code like this in ChronoForms is that many users want to do different things and it's hard to find code that is useful for a wide range of people; also I think that Joomla 1.5 has MooTools built in and I don't know if MooTools and Prototype are compatible - there are two big libraries there.

Bob
gg4j 13 Nov, 2007
what is mootool?

how does it work? does it have an hint JS to use with CC?

Could you give me sm basic instruction of how to extend the file prototype in CC with new JS function? I'm not that good in coding.
But if have some spare time I could try..🤣
Is the CC's prototype the prototype library you told?
GreyHead 13 Nov, 2007
Hi gg4j,

I'll try and explanation here (but, as I've said before, I'm no JavaScript expert, so I may get stuff wrong!).

JavaScript is a fairly basic coding language but one that runs in web browsers and so lets you create interactive web pages. There are lots of ways that pages can interact: image rollovers, menu fly-outs, drag and drop boxes, appearing and disappearing text, etc. and, more recently, getting new data from the server by using Ajax (basically a method to send a behind the scenes message to the server and use the reply to update the screen without re-writing the whole page.

Originally most of these functions were hand-coded and you can find scripts all over the web to do these things. As these got more complicated they got bigger and harder to maintain and some users found that there was a lot of common functionality, that scripts needed to understand and talk to the DOM page structure for example.

So some 'frameworks' started to appear. These are JavaScript code libraries that include code to do the basics, they provide the common functionality that allows code developers to focus on the more interesting parts of the code that deliver results. There are several of these frameworks including Prototype, JQuery and MooTools (there's a fuller list at the end of this page.

Here's how jQuery describes itself:

jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages.

and the others say similar things.

Prototype is slight different in that is is used as the underlying framework for the well-known [url-http://script.aculo.us/]Script.aclo.us[/url] effects library while (jQuery and MooTools include effects libraries of their own).

So now developers tend to use one of these frameworks as a core tool and then build add-on libraries to deliver the particular results they want. So Script.aculo.us is an add-on for Prototype; the Validation that ChronoForms uses* is a also a Prototype add-on - that also uses the Effects library from Script.aculo.us

There was no JavaScript Framework in Joomla 1.0.x, although many add-ons would load one or the other. This causes a few potential problems, sometimes there can be conflicts between different frameworks (especially if they use functions with the same name), and the page load sizes increase, etc.

In Joomla 1.5 the developers have decided to include MooTools (see here and in the releases it is found in media/system/js and mootools.js is loaded from the page header.

'Low Pro' is an add-on for Prototype that "makes it easier to implement unobtrusive DOM scripting". If you install this as well as Prototype then you can make effects with just a few lines of code. But to do this you have to understand the libraries that you are using!!

Because Joomla 1.5 has includes MooTools that seems to be the way to go for future development of JavaScript for ChronoForms - but that's just my opinion.

For example, look at the MooTools Tips demo and you can see something that could do what you are looking for.

Sorry this has been quite so long.

Bob


*Really Easy Field Validation from Andrew Tetlaw see here
gg4j 14 Nov, 2007
Thanks BOB, a bit clearer now.
This topic is locked and no more replies can be posted.