Jump to content

Javascript in Smarty .tpl files?


cian1991ferrari

Recommended Posts

Hi everyone, I've written a few functions and checks to validate credit card form information. My problem is they're in PHP and in order for them to check the fields, I must let users submit the form which cause some problems and isn't too secure.

I'm proposing of writing an external JavaScript page with a validate function but I don't know how to use the JavaScript in templates. I'm thinking of putting the validate() function to occur when the submit is clicked such as:
and obviously must call the JS page in header section but is there other stuff I have to know such as special tags?

Link to comment
Share on other sites

do you know if it is possible to add JS or CSS through a TPL so it gets included in the header, I noticed the folling code but am not sure how it is executed.

{if isset($js_files)}
   {foreach from=$js_files item=js_uri}
   [removed][removed]
   {/foreach}
{/if}

Link to comment
Share on other sites

  • 1 year later...
  • 1 month later...
  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...