Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6548793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:00:47+00:00 2026-05-25T12:00:47+00:00

Let’s say I have a ColdFusion Model Glue view called login.cfm . In it,

  • 0

Let’s say I have a ColdFusion Model Glue view called login.cfm. In it, I have a form:

<form id="loginForm" action="#event.linkTo("user.login")#" method="POST">
    E-mail: <input id="emailField" type="text" name="email">
    Password: <input id="passwordField" type="text" name="password">
    <input type="submit" value="Login">
</form>

Now I want to add in some Javascript validation for when the user clicks the Login button. Something like this in jQuery:

<script type="text/javascript">
    $(function() {
        $('#loginForm').submit(function() {
            // check that emailField is not empty and is a valid e-mail
            // check that passwordField is not empty
            // if validation fails, add in DOM elements to show error messages
        });
    });
</script>

Where should I be adding this Javascript code? Do I stick it directly into the login.cfm view? Or is there a better way of handling this? Preferably, I’d like to stick my Javascript code from all my views to the bottom of the body.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:00:48+00:00Added an answer on May 25, 2026 at 12:00 pm

    There are a quite a few different strategies for this. The easiest is it put your view-specific script in a single .js file and include it through a <script src="path"></script> tag just before closing the <body> tag.

    You can also look at libraries such as require.js that allow you to asynchronously load script files and their dependencies.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say you have a class called Customer, which contains the following fields: UserName
Let's say I have an abstract parent class called shape, and that there are
Let's say I have the following models class Photo(models.Model): tags = models.ManyToManyField(Tag) class Tag(models.Model):
Let's say I have an image called hello.png with dimensions 200x100 . I create
Let's say that I have a model that handles recipes, and I want to
Let's say you create a wizard in an HTML form. One button goes back,
Let's say I'm building a data access layer for an application. Typically I have
Let's say we have a simple function defined in a pseudo language. List<Numbers> SortNumbers(List<Numbers>
Let's say I have a drive such as C:\ , and I want to
Let's say that we have an ARGB color: Color argb = Color.FromARGB(127, 69, 12,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.