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 8321811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:09:17+00:00 2026-06-08T23:09:17+00:00

I have a page with an editable field and several required fields. The problem

  • 0

I have a page with an editable field and several required fields. The problem is that whenever I click on a button to activate the editable field for making changes, or when applying/cancelling those changes, it causes my Javascript to fire again which appends yet another “required field” indicator to my required fields. I want the indicator to ONLY be appended on the first load, and not to be affected by buttons clicked on the interface. How can I accomplish this? I believe I just need the right condition for my Javascript “if” statement, but have no idea what that might be. I’ve researched it and come up dry.

Here’s my markup. You can safely ignore entire UpdatePanel region. The only thing you need to know, is that the buttons within it are causing the Javascript to run again for each click.

Thanks! 😉

<asp:Content runat="server" ContentPlaceHolderID="HeadContent">
    <script type="text/javascript">
        function contentPageLoad() {
            // Add "Required Field" Indicators
            if (/*NEED CONDITION*/) {
                $("h4.required").append(" <span class=\"r\">*</span>");
            }
        }
    </script>
</asp:Content>
<asp:Content runat="server" ContentPlaceHolderID="MainContent">
    <!-- This is an updatable textfield. -->
    <!-- PROBLEM!: LinkButtons here cause the double firing of the javascript above. -->
    <!-- Remember that "ChildrenAsTriggers" defaults to True for UpdatePanel. -->
    <asp:UpdatePanel ID="RequestorNameUpdatePanel" runat="server">
    <ContentTemplate>
    <asp:MultiView ID="RequestorName_mv" runat="server" ActiveViewIndex="0">
        <asp:View ID="RequestorNameNormalView" runat="server">
            <div class="rightCol">
                <asp:LinkButton ID="editRequestorName" runat="server" />
                <h6 class="inlineH">Requestor's Name: <asp:Label ID="RequestorName_lbl" runat="server"></asp:Label></h6>
            </div>
        </asp:View>
        <asp:View ID="RequestorNameEditView" runat="server">
            <div class="rightCol">
                <asp:LinkButton ID="updateRequestorName" runat="server" />
                <asp:LinkButton ID="cancelRequestorName" runat="server" />
                <h6 class="inlineH">Requestor's Name: </h6>
                <asp:DropDownList ID="RequestorName_ddl" runat="server" ViewStateMode="Inherit" AutoPostBack="False" ></asp:DropDownList>
                <asp:TextBox ID="RequestorName_cb" runat="server" EnableViewState="True" AutoPostBack="False"></asp:TextBox>
                <button id="RequestorName_btn" type="button" class="toggle ui-button"></button>
            </div>
        </asp:View>
    </asp:MultiView>
    </ContentTemplate>
    </asp:UpdatePanel>

    <!-- "REQUIRED" indicator from javascript appended here -->
    <h4 class="required">First Name</h4>
    <asp:TextBox ID="tbFirstName" runat="server"></asp:TextBox>
</asp:Content>
  • 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-06-08T23:09:20+00:00Added an answer on June 8, 2026 at 11:09 pm

    Put this code on document ready.

    $(document).ready(function() {
      $("h4.required").append(" <span class=\"r\">*</span>");
    });
    

    Then it will not be called when your update panels load.

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

Sidebar

Related Questions

I have a page that may have 10 or so editable 'panels' of information.
I have a page that contains a parent record and several children records. There
I have a website that does not have page refreshes when the visitor navigates
I have a TLF editable field in a swf file. Text entered there gets
I have a web page with an editable DetailsView. After it is (successfully) edited,
I have a page that has multiple parts of the page loaded via ajax,
I have a page layout for my MOSS '07 site that I want put
I have jeditable fields that are updated by AJAX so am using .live ()
I have a page with a repeater.. I have to make some fields of
I have a model which has several fields which I never want to be

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.