Jump to:

22977 Posts in 11806 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » adding javascript to a form

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 922 Views
  • TerryMiddleton
    Avatar
    Community Member
    108 Posts

    adding javascript to a form Link to this post

    How do you add javascript processing to a form?

    I see that it builds the js for the form when you have required field. How can I add a little more process like: is field x a certain length?

    I have the code, I just don't know how t add it to the form processing?

    Terry

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: adding javascript to a form Link to this post

    In the function you are outputing the form in - like function Form() you need to include Requirements::customScript("My JS HERE") or Requirements::javascript("link/to/file.js"); which will include the given JS with the form

    922 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.