locked
javascript onchange event RRS feed

  • Question

  • User-125499312 posted

    I have a textbox that I amm assigning a value to it via javascript without the user actually typing in a value.

    I would like to fire a javascript function after the value get put into the textbox.

    the onchange event only fires when you actually type in a value.

    Thanks for help

    Tuesday, November 13, 2007 8:44 PM

Answers

  • User1893523956 posted

    Hi!

    Why not call the function directly after you assign the value to the textbox? Since you want to fire (execute) a javascript function after you assign value to a textbox, I think you should just call the function directly after assigning value to the textbox and not rely on the onchange event.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 13, 2007 9:29 PM
  • User844797000 posted

    Hi,

    instead of onchage event, you can use onpropertychange event...

    like <asp:textbox......  onpropertychange="yourfunctuion();">

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 14, 2007 12:26 AM

All replies

  • User1893523956 posted

    Hi!

    Why not call the function directly after you assign the value to the textbox? Since you want to fire (execute) a javascript function after you assign value to a textbox, I think you should just call the function directly after assigning value to the textbox and not rely on the onchange event.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 13, 2007 9:29 PM
  • User844797000 posted

    Hi,

    instead of onchage event, you can use onpropertychange event...

    like <asp:textbox......  onpropertychange="yourfunctuion();">

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 14, 2007 12:26 AM
  • User2008424322 posted

    Hi,

    you can also use onblur method.

    like <asp:textbox......  onblur="yourfunctuion();">

    Thanks 

     

    Wednesday, November 14, 2007 1:26 AM
  • User-940734288 posted

    Hi,
    I have a similar problem and can’t seem to find any real help regarding this.

    i have a page that uses and iframe to “lookup” values and then post it to the parent form/page using java script.
    sample code:
    function postParent()
    {
    // parent objects (Mariner page)
    var parName = parent.document.getElementById(’myTextbox′);

    var parIframe = parent.document.getElementById(’myFrame′);

    // iframe objects
    var oName = document.getElementById(’txtNameOnFrame’);

    // import the select values
    parName.value = oName.value;

    // hide the iframe
    parIframe.style.height = 0;
    parIframe.style.visibility = “hidden”;

    }

    My issue is that when I post the page to store the data, the value on the textbox populated using code, is blank. however, if i type any additional text into the textbox, then it posts the data correctly.
    i tried onblur, this.value=this.value etc. but all with no success.
    Can you see something that i don’t or can this not be done.

    Regards

    Danny

    Friday, November 23, 2007 4:03 AM