You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2007/11/05 05:10:30 UTC

T5: disable javascript

Hi,

Is there a way to disable or exclude those default javascripts(that's around
200k in size)? I notice if there is form in a page T5 will include some
javascript files. I disable the browser's javascript and the page still
works with those validations done in the server, that means we don't really
need javascript for the form, right?

The reason I will disable the javascript is, when you load a page using
jQuery/Thickbox, if the page has form with javascript, it will fail, Firebug
reports 6 errors on those js files, I have to use pure html form now for
that so I can't use the onValidate event in the server side for validation,
any idea? Thanks,

A.C.
-- 
View this message in context: http://www.nabble.com/T5%3A-disable-javascript-tf4749556.html#a13581181
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: disable javascript

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Kris,

so far the approach works, it's just a workaround, I'm eagerly waiting for
T5's Ajax support. a little curious as well, how framework provides Ajax
support? T5 is loading around 200k js files, that's far bigger than jQuery's
20k, might be better T5's core should not deal with Javascripts, an add on
module will, if user does not use those features that requires js, it will
save around 200k.

A.C.


kristian.marinkovic wrote:
> 
> hi angelo,
> 
> you reached a point where you have to digg a little deeper :)
> 
> in order to achieve what you want you'll have to 
> provide your own DocumentScriptBuilder ( 5.0.5) 
> or DocumentHeadBuilder (>= 5.0.6)
> 
> please checkout the source and search for the class
> you'll see it is not that complicated :)
> 
> g,
> kris
> 
> 
> 
> 
> Angelo Chen <an...@yahoo.com.hk> 
> 05.11.2007 07:23
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
> 
> 
> An
> users@tapestry.apache.org
> Kopie
> 
> Thema
> Re: T5: disable javascript
> 
> 
> 
> 
> 
> 
> 
> 
> found a workaround on this, surround the <body> with <div>
> 
> <div>
> <body>
> </body>
> </div>
> 
> T5 will not include javascript in the rendered page, but not sure if this
> works with 5.06.
> 
> 
> Angelo Chen wrote:
>> 
>> Hi,
>> 
>> Is there a way to disable or exclude those default javascripts(that's
>> around 200k in size)? I notice if there is form in a page T5 will 
> include
>> some javascript files. I disable the browser's javascript and the page
>> still works with those validations done in the server, that means we 
> don't
>> really need javascript for the form, right?
>> 
>> The reason I will disable the javascript is, when you load a page using
>> jQuery/Thickbox, if the page has form with javascript, it will fail,
>> Firebug reports 6 errors on those js files, I have to use pure html form
>> now for that so I can't use the onValidate event in the server side for
>> validation, any idea? Thanks,
>> 
>> A.C.
>> 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/T5%3A-disable-javascript-tf4749556.html#a13581860
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-disable-javascript-tf4749556.html#a13584093
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: disable javascript

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
hi angelo,

you reached a point where you have to digg a little deeper :)

in order to achieve what you want you'll have to 
provide your own DocumentScriptBuilder ( 5.0.5) 
or DocumentHeadBuilder (>= 5.0.6)

please checkout the source and search for the class
you'll see it is not that complicated :)

g,
kris




Angelo Chen <an...@yahoo.com.hk> 
05.11.2007 07:23
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
users@tapestry.apache.org
Kopie

Thema
Re: T5: disable javascript








found a workaround on this, surround the <body> with <div>

<div>
<body>
</body>
</div>

T5 will not include javascript in the rendered page, but not sure if this
works with 5.06.


Angelo Chen wrote:
> 
> Hi,
> 
> Is there a way to disable or exclude those default javascripts(that's
> around 200k in size)? I notice if there is form in a page T5 will 
include
> some javascript files. I disable the browser's javascript and the page
> still works with those validations done in the server, that means we 
don't
> really need javascript for the form, right?
> 
> The reason I will disable the javascript is, when you load a page using
> jQuery/Thickbox, if the page has form with javascript, it will fail,
> Firebug reports 6 errors on those js files, I have to use pure html form
> now for that so I can't use the onValidate event in the server side for
> validation, any idea? Thanks,
> 
> A.C.
> 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-disable-javascript-tf4749556.html#a13581860
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org



Re: T5: disable javascript

Posted by Angelo Chen <an...@yahoo.com.hk>.
found a workaround on this, surround the <body> with <div>

<div>
<body>
</body>
</div>

T5 will not include javascript in the rendered page, but not sure if this
works with 5.06.


Angelo Chen wrote:
> 
> Hi,
> 
> Is there a way to disable or exclude those default javascripts(that's
> around 200k in size)? I notice if there is form in a page T5 will include
> some javascript files. I disable the browser's javascript and the page
> still works with those validations done in the server, that means we don't
> really need javascript for the form, right?
> 
> The reason I will disable the javascript is, when you load a page using
> jQuery/Thickbox, if the page has form with javascript, it will fail,
> Firebug reports 6 errors on those js files, I have to use pure html form
> now for that so I can't use the onValidate event in the server side for
> validation, any idea? Thanks,
> 
> A.C.
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-disable-javascript-tf4749556.html#a13581860
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: disable javascript

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Christian,

I created a simple project and put a simple form there, got the same result
as yours, don't know why. so I copied my complicated form over and reduce it
to the following, it removes those javascripts, I can't tell why as I
already erased the first simple form:( please try this template, see if it
produce the same output as mine, kind of mystery here:(

here is the template:

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
    <title>hilo Start Page</title>
</head>
<body>
<h1>my form</h1>
    <t:form t:id="comment_form" t:clientValidation="false">
        <input t:type="textfield" t:id="name" />
        <input t:type="submit" name="Submit" t:id="Submit" value="Submit"/>
    </t:form>

</body>
</html>

here is the rendered page:
<html>
<head><link href="/assets/tapestry/default.css" rel="stylesheet"
type="text/css">
    <title>hilo Start Page</title>
</head>
<body>
<h1>my form</h1>
    <form action="/myform.comment_form" id="comment_form" method="post"
name="comment_form"><div class="t-invisible"><input name="t:formdata"
type="hidden"
value="H4sIAAAAAAAAAFvzloG1nJeB27fSLb8o1yovMTe1uIjBKr8oXS+xIDE5I1WvJLEgtbikqFIvOb8oNSczSS8psThVzzEJKJaYXOKWmZqTohKcWlJa4Jhckpmfpxp6mPuh6PE/TAyMPgw88ak5qbmpeSV+QHNLGIR8shLLEvVzEvPS9YNLijLz0q0rCkoYWEC2YjrCjURHBBTlJ6cWFweXJuVmFhcDnQJx0OF1KSZp3+adY2JgqCgo52fghdpSDFJXUlzIUMfAUMLABtZWgiEPkmYFADYHBGIlAQAA"></div>
        <input id="name" name="name" type="text" value="">
/assets/tapestry/field-error-marker.png 
        <input id="Submit" name="Submit" type="submit" value="Submit">
/assets/tapestry/field-error-marker.png 
    </form>

</body>
</html>






Angelo Chen wrote:
> 
> Good you pointed out, It works now with 5.0.6. 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-disable-javascript-tf4749556.html#a13610740
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: disable javascript

Posted by Christian Köberl POI <ch...@porsche.co.at>.

Angelo Chen wrote:
> 
> Good you pointed out, It works now with 5.0.6. 
> 
Hey, that's good - I checked that and it seems to work.

But then I looked at how and it seems that Tapestry still generate the
validation script:
<script type="text/javascript">
<!--
Event.observe(window, "load", function() {
Tapestry.Field.required('name', 'You must provide a value for Name.');
});
// -->
</script>

It also adds the dependecies to the header - this is why it works now. It
would be a lot nicer if the scripts were removed when clientValidation is
false :(

A partly happy,
Chris

-- 
View this message in context: http://www.nabble.com/T5%3A-disable-javascript-tf4749556.html#a13606148
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: disable javascript

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Christian,

Good you pointed out, It works now with 5.0.6. I upgraded to 5.0.6 yesterday
hoping <t:container></t:container> might be a better option than <div></div>
hack, so for 5.0.5 user I do have some contribution, use
<div><body><body></div>. clientvalidation="false" works with 5.0.6 only. 
Lashita's post reminded me a story, a guy trying to study Bible, he studied
all books about Bible except the Bibile itself:( ok, let me read the
Form.java now;-))

A.C.


Christian Köberl POI wrote:
> 
> Hello Angelo!
> 
> 
> Angelo Chen wrote:
>> 
>> You could have saved me one day work:) 
>> 
> 
> It could have saved you one day if it would work, but unfortunately it
> doesnt: http://issues.apache.org/jira/browse/TAPESTRY-1748
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-disable-javascript-tf4749556.html#a13603300
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: disable javascript

Posted by Christian Köberl POI <ch...@porsche.co.at>.
Hello Angelo!


Angelo Chen wrote:
> 
> You could have saved me one day work:) 
> 

It could have saved you one day if it would work, but unfortunately it
doesnt: http://issues.apache.org/jira/browse/TAPESTRY-1748
-- 
View this message in context: http://www.nabble.com/T5%3A-disable-javascript-tf4749556.html#a13602999
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: disable javascript

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Lastiha,

You could have saved me one day work:) it's exactly what I'm looking for,
well, my fault not reading the doc:(( anyway, I do find something
interesting about T5's form, when a form is loaded using Ajax, the scripts
do not completely loaded causing several errors and you see a blank screen,
one way to fix this is, manually add those scripts(Prototype, Scriptaculous,
Tapestry.js) in the parent template and disable the script in the "calling
page", this somehow works(client side validation). thanks.
A.C.


lasitha wrote:
> 
> On 11/5/07, Angelo Chen <an...@yahoo.com.hk> wrote:
>>
>> Is there a way to disable or exclude those default javascripts(that's
>> around
>> 200k in size)? I notice if there is form in a page T5 will include some
>> javascript files.
> 
> Angelo, perhaps i'm missing something but couldn't you just set
> clientValidation="false" ?
> http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html#orgapachetapestrycorelibcomponentsform
> 
> Cheers,
> lasitha.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-disable-javascript-tf4749556.html#a13602475
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: disable javascript

Posted by lasitha <la...@gmail.com>.
On 11/5/07, Angelo Chen <an...@yahoo.com.hk> wrote:
>
> Is there a way to disable or exclude those default javascripts(that's around
> 200k in size)? I notice if there is form in a page T5 will include some
> javascript files.

Angelo, perhaps i'm missing something but couldn't you just set
clientValidation="false" ?
http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html#orgapachetapestrycorelibcomponentsform

Cheers,
lasitha.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org