Forum Discussion

RyanHuffman's avatar
RyanHuffman
Qrew Cadet
8 years ago

Update Value Without Clicking Outside of Field?

Is there a way to update the value in a field without having to click elsewhere on the page first?

I have a page with a single text entry field and a formula URL "Enter" button that compares the value in the field with an existing value when clicked. I've noticed that the formula does not update until the user clicks outside of the text field in question after entering a value. If I enter a value and immediately click the button it updates the value and does nothing (must be clicked again to work) or if I hit the enter/return key, it does not compare the current value and comes up wrong. Can I ensure that the formula URL updates as text is entered into the input box? Can provide more details, if necessary. Thanks!
    • RyanHuffman's avatar
      RyanHuffman
      Qrew Cadet
      Has to be free form, due to the nature of the page's functionality.
  • I haven't fully implemented this but I think I figured it out. Using Dan's world famous IOL technique and handy dandy JavaScript, I am going to add an "oninput" event to the input element and trigger the OnBF(this) that is normally triggererd when the element is blurred (or no longer selected, as happens when we click outside of the input field). This way, every time the user types a new character, the input element performs the same action as when we click away from it, thus updating the formula for the "Enter" button.

    _EDIT:_ I did also have to add an "onkeypress" event handler to the text box to click the button as well because hitting the enter/return key was not registering as clicking the "Enter" button because it is a link element rather than a form submit.
    • PatrickDunn's avatar
      PatrickDunn
      Qrew Assistant Captain
      Hello. Don't suppose you happen to have the code handy still, do you? I'm attempting to address a very similar problem. Thanks!
  • Dan posted a pastie for doing an automated reload of a home page. It works and you can adjust the time:

    <script>
      setTimeout(function(){
         parent.location.reload(1);
      }, 180000);
    </script>

    Maybe try the .reload(1) function with the "oninput" event?