Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Forrest: User

Newbie with some javascript questions

 

 

Forrest user RSS feed   Index | Next | Previous | View Threaded


eric.m.lipsius at lmco

Jun 6, 2007, 6:10 AM

Post #1 of 6 (448 views)
Permalink
Newbie with some javascript questions

I was looking at the FAQ on adding my own javascripts so I can use them
on my forrest page

I am new at using forrest mainly only have done simple pages in the past
using html and javascripts and some CSS.

but the FAQ lacks on a good description or example on what to edit and
where for adding my own js files for use.

I am writing a some javascripts to validate my a form prior to
submitting it to a php script. I created a file called validations.js
and put it in
.../xdocs/resources/scripts and made sure in the forrest.properties file
that resources is mapped.

in the page I have <script type="text/javascript"
src="/resources/scripts/valdiations.js" /> between the header tags.


My scripts work outside of forrest in standard html pages, but I can not
get them to work using forrest, what am I doing wrong, and I can't find
a document to help me with it.

Thanks,
--------------------------------------------

Eric


rgardler at apache

Jun 6, 2007, 7:39 AM

Post #2 of 6 (426 views)
Permalink
Re: Newbie with some javascript questions [In reply to]

On 06/06/07, Lipsius, Eric M <eric.m.lipsius [at] lmco> wrote:
>
>
> I was looking at the FAQ on adding my own javascripts so I can use them on
> my forrest page

...

> in the page I have <script type="text/javascript"
> src="/resources/scripts/valdiations.js" /> between the
> header tags.

In the FAQ entry it says:

"Then refer to those from your source documents with URIs like
/skin/blah.js and /skin/foo.css"

compare the URI in the faq to the uri you are using.

Ross


eric.m.lipsius at lmco

Jun 6, 2007, 9:23 AM

Post #3 of 6 (427 views)
Permalink
RE: Newbie with some javascript questions [In reply to]

I have also tried placing them in the
src/documentation/skins/$skin-name/scripts directory

Well actually had to create the /skins/pelt/scripts directory myself and
tried accessing it from /skins/validations.js

But that does not work either. I tried looking at the resources.xmap to
understand it better but that did not help me.

This is how my code looks in my source file:

<document>
<header>
<title>Search Tools</title>
<script type=text/javascript" src="/skins/validations.js"/>
</header>
<body>
.....
</body>
</document>

Am I not calling it correctly?


------------
Eric


bdube at apache

Jun 6, 2007, 10:13 AM

Post #4 of 6 (427 views)
Permalink
Re: Newbie with some javascript questions [In reply to]

Lipsius, Eric M wrote:
> This is how my code looks in my source file:
>
> <document>
> <header>
> <title>Search Tools</title>
> <script type=text/javascript" src="/skins/validations.js"/>
> </header>
> <body>
> .....
> </body>
> </document>
>
> Am I not calling it correctly?

XDoc has no script element. I don't recall at the moment how this is
done with skins. By looking at pelt's document-to-html stylesheet, it
looks like this element will be stripped implicitly. I don't think the
solution calls for a custom skin, but I don't remember the details. It
may be injected by skinconf.xml the way extra CSS is handled. With
skins, I think the solution applies to every document and is not handled
per document.

Brian


rgardler at apache

Jun 6, 2007, 12:32 PM

Post #5 of 6 (424 views)
Permalink
Re: Newbie with some javascript questions [In reply to]

On 06/06/07, Brian M Dube <bdube [at] apache> wrote:
> Lipsius, Eric M wrote:
> > This is how my code looks in my source file:
> >
> > <document>
> > <header>
> > <title>Search Tools</title>
> > <script type=text/javascript" src="/skins/validations.js"/>
> > </header>
> > <body>
> > .....
> > </body>
> > </document>
> >
> > Am I not calling it correctly?
>
> XDoc has no script element. I don't recall at the moment how this is
> done with skins. By looking at pelt's document-to-html stylesheet, it
> looks like this element will be stripped implicitly. I don't think the
> solution calls for a custom skin, but I don't remember the details. It
> may be injected by skinconf.xml the way extra CSS is handled. With
> skins, I think the solution applies to every document and is not handled
> per document.

Hmmm... that's interesting. Our FAQ clearly states that this is
possible, but it appears the FAQ entry is misleading. Brian is correct
that the script element is not allowed in our XDoc.

There has been some discussion in the past, in particular see [1]
(which interestingly enough was written by me, but it was a long time
ago so you'll forgive me for not remembering, I hope. Note that my
reference to forrest:views at the end should now be read as
"dispatcher" which is now pretty stable in the whiteboard and will
almost certainly be moving out sometime in the near(ish) future.

In [2] you will find a little more discussion from someone who tried,
but failed to get this working. Let us know if you too have help, but
please give plenty of details, most of us do not embed javascript in
out source so we'll be providing options and pointers rather than
direct answers.

It would be really helpful if you could provide us with a better
answer to the FAQ question once you have this nailed.

Ross

[1] http://www.mail-archive.com/user [at] forrest/msg00993.html
[2] http://thread.gmane.org/gmane.text.xml.forrest.user/3703/focus=3709


crossley at apache

Jun 6, 2007, 6:21 PM

Post #6 of 6 (426 views)
Permalink
Re: Newbie with some javascript questions [In reply to]

Ross Gardler wrote:
> Brian M Dube wrote:
> >Lipsius, Eric M wrote:
> >> This is how my code looks in my source file:
> >>
> >> <document>
> >> <header>
> >> <title>Search Tools</title>
> >> <script type=text/javascript" src="/skins/validations.js"/>
> >> </header>
> >> <body>
> >> .....
> >> </body>
> >> </document>
> >>
> >> Am I not calling it correctly?
> >
> >XDoc has no script element. I don't recall at the moment how this is
> >done with skins. By looking at pelt's document-to-html stylesheet, it
> >looks like this element will be stripped implicitly. I don't think the
> >solution calls for a custom skin, but I don't remember the details. It
> >may be injected by skinconf.xml the way extra CSS is handled. With
> >skins, I think the solution applies to every document and is not handled
> >per document.
>
> Hmmm... that's interesting. Our FAQ clearly states that this is
> possible, but it appears the FAQ entry is misleading. Brian is correct
> that the script element is not allowed in our XDoc.
>
> There has been some discussion in the past, in particular see [1]
> (which interestingly enough was written by me, but it was a long time
> ago so you'll forgive me for not remembering, I hope. Note that my
> reference to forrest:views at the end should now be read as
> "dispatcher" which is now pretty stable in the whiteboard and will
> almost certainly be moving out sometime in the near(ish) future.
>
> In [2] you will find a little more discussion from someone who tried,
> but failed to get this working. Let us know if you too have help, but
> please give plenty of details, most of us do not embed javascript in
> out source so we'll be providing options and pointers rather than
> direct answers.
>
> It would be really helpful if you could provide us with a better
> answer to the FAQ question once you have this nailed.
>
> Ross
>
> [1] http://www.mail-archive.com/user [at] forrest/msg00993.html
> [2] http://thread.gmane.org/gmane.text.xml.forrest.user/3703/focus=3709

There is a way to do it using xdoc source format.
Add a "<script ..." to the body element and disable
validation of these xml sources. It is cheating
but it should work.

Another way might be to intercept the xml pipeline
and add another transformation to inject the extra
"<script ..." element.

Our internal format is not being validated, so it
should be able to be overloaded with extra elements.

Another way is to hack the pelt skin and explicitly
add the "<script ..." to the html output.

As Brian said above, we could add a basic solution
by doing something similar to "extra-css" in skinconf.

None of these solutions are ideal. Hence Dispatcher.

-David

Forrest user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.