Categories > TinyButStrong general >

is it possible to run javascript in subtemplates?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: handoko
Date: 2010-08-18
Time: 20:14

is it possible to run javascript in subtemplates?

Dear team,

Is it possible to run javasrcipt on subtemplates?
for example i want to trigger a window alert when onsubmit event occur of a form if a field is still empty,

actually it is work by non-subtemplates method, but it doesn't on subtemplates.

Thanks
By: Skrol29
Date: 2010-08-19
Time: 02:15

Re: is it possible to run javascript in subtemplates?

Hi,

I can see two ways:

1) In the subtemplate, you can move your <script> element from the <head> element to a place before the <form> element.
Thus, the script is still available and it is taken by TBS with the subtemplate.

2) You can let the <script> element in the <head> element of the subtemplate, but you tell TBS to get it with the subtemplate:
[onload;file=header.htm;getbody=(script)+body]
This is working only if you have no <script> element in the <body>. otherwise TBS will duplicate them. This is a a bug still existing in version 3.5.3.