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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:44:15+00:00 2026-05-16T22:44:15+00:00

I am passing in a value to the form that I ultimately assign to

  • 0

I am passing in a value to the form that I ultimately assign to a textbox using javascript. The value is a calculation based on values from another page/form. However, the textbox is editable.

When reloading the form with the previously saved data, I don’t want the value of the textbox to be overwritten with the pre-calculated value from another page if it was edited manually upon save.

The other stipulation is, the page/form that has the values that the calculation is created from, can be changed. Therefore, I would also want to check to see if the calculated value has changed since last load, and if so, load that over the manually entered value.

So…
If textbox is blank populate with calculated value
else if
Manually entered value trumps calculated value
else if
calculated value has changed since last calculation, it trumps manually entered value.

The other concern with this all, is how do I determine if the user has typed in the textbox to determine if the value was manually entered?

  • 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-16T22:44:16+00:00Added an answer on May 16, 2026 at 10:44 pm

    You can accomplish this with a couple of session variables. The first session variable is the value of the TextBox. Since you have another page generating the value for you, you can’t rely on the ViewState to store the value for you, it only work with PostBacks on the page.

    The second session variable is a simple boolean value you can call IsCalculated. This can be set to true or false based on the situation at hand.

    The final step is when to trigger the change of the IsCalculated value. You can easily wire up a TextChanged event to the TextBox using jQuery, or even standard Javascript. Unless you want to setup AJAX as well to set the Session variable, your best bet would be to have a hidden form field called IsCalculated as well that is modified by the TextChanged event.

    When loading the “primary” page, you can then easily implement the rules listed above on which value needs to go into the textbox. If the value is then manually changed, the JavaScript event will trigger, and when you move on to the “calculation” page, you’ll want to check the hidden form field and set the session variable of IsCalculated accordingly. You can do whatever calculations are needed, return to the “primary” page, and implement the display rules again accordingly.

    Note: You mentioned in the question that the calculated value would be passed to the page, I’m assuming through the URL parameters, which is why you only need a single session variable tracking the value of the TextBox. If this is not the case, you may need a second session variable. One to track the TextBox value, and one to track the calculated value going in.

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

Sidebar

Related Questions

I'm passing a javascript variable in my PHP form that gets passed as formatted
I'd like to submit a form using GET but without passing the value of
I have an html/jsp form that I am serializing(using jquery) and passing to a
I am developing online form that would store values and passed them to another
I'm trying to glue together two web services by passing a value from one
I have a JTextField that I'm not always passing a value to, but it
I am having trouble passing the return value from TheMethod() to Main and displaying
I know that when passing an object by value to a function, the move
I'm passing query string parameter to .aspx page with 'Ñ' character in value. But
I am trying to open a form by passing a value to its tableadapter.

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.