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

  • Home
  • SEARCH
  • 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 636937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:34:08+00:00 2026-05-13T20:34:08+00:00

I want to validate the fields of the list item while adding/editing and stop

  • 0

I want to validate the fields of the list item while adding/editing and stop the saving operation and provide the error information what the user made on that page itself.

For ex, if I want to prevent user not to leave few fields set before saving based on particular status of another field, I cannot make the field as mandatory.

  • 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-13T20:34:09+00:00Added an answer on May 13, 2026 at 8:34 pm

    Use PreSaveAction.

    Add a javascript function named PreSaveAction to your page (it’s best if you are creating a custom List Template and can modify the aspx page that will be used as EditForm and NewForm, otherwise try the Content Editor Web Part or by modifying the Master Page) and do all your custom validation from there.

    For example, I just used it on a project where we had three percent fields that had to equal 100%. I used the following javascript and it worked great:

    function getTagFromIdentifierAndTitle(tagName, identifier, title) {
        var len = identifier.length;
        var tags = document.getElementsByTagName(tagName);
        for (var i = 0; i < tags.length; i++) {
            var tempString = tags[i].id;
            if (tags[i].title == title && (identifier == "" || tempString.indexOf(identifier) == tempString.length - len)) {
                return tags[i];
            }
        }
        return null;
    }
    
    function PreSaveAction() {
        var top = getTagFromIdentifierAndTitle("input", "TextField", "Top %");
        var middle = getTagFromIdentifierAndTitle("input", "TextField", "Middle %");
        var bottom = getTagFromIdentifierAndTitle("input", "TextField", "Bottom %");
        var valid = (100 == parseInt(top.value) + parseInt(middle.value) + parseInt(bottom.value));
        if (!valid) {
            alert("Top %, Middle %, and Bottom % must equal 100% when added.");
        }
        return valid;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form containing a list of input fields that the user populates
I'm trying to validate that the fields given to sphinx are valid, but I'm
I have a class Employee. I want to be able to Validate() it before
I would like to disable client side validation on certain fields in my user
I have a form where a user can toggle receiving funds either via check
I have a Rails application that lists information about local services. My objectives for
I have an object Tasks with a model like this has_many :notes, :validate =>
I'm using django-ajax-selects , which is a freely available django app providing jquery autocomplete
I'm new to Django, trying to process some forms. I have this form for

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.