How to trigger the onChange/OnBlur event when value changed in a text box from background JavaScript function

Hi,
   I have a text box which takes a date value and i have a icon by the side of the box which performs the JS calender functionality.I have a button which i am supposed to enable when valid date is entered.

when a user enters valid date manually the button is getting enabled. but when the user uses the calender functionality to get the date in the text field the OnChange is not being triggered so the button is not being enabled. Can some one suggest a way by which i can make this work.

How to trigger the onChange/OnBlur event when value changed in a text box from background JavaScript function.

Thanks in advance.

-Avinash
aviponugotiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

knightEknightCommented:
just before the calendar closes, do this:

document.formName.textBoxName.onchange();
0
justinbilligCommented:
You have to manuall call the on change event

formname.textboxname.onchange( );

0
justinbilligCommented:
doh
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

knightEknightCommented:
great minds think alike!  (and so do ours:)
0
aviponugotiAuthor Commented:
THanks for the reply. The calender is a global thing which is beinging used all over the application. I can not change any code related to that.
I will i  know that the calender fucntionality is done for me to explicitly call the onChange() event.

Looking for ur reply.
-Avinash
0
justinbilligCommented:
do you have a button that opens the calender up?

<input type="button" onclick="FunctionThatOpensYourCalender( );formname.textboxname.onchange( );">
0
aviponugotiAuthor Commented:
I have a button that opens the calender i already tried what u suggested.

The calender only opens when the function is called it does not insert a value in to the textbox. I want the onChange to be called after the value is inserted by the calender function.

Thanks
Avinash
0
knightEknightCommented:
that is why you will need to do it when the calendar closes -- or when the calendar changes the date field.
You say you can't change the calendar code ... can you look at it and see what it is doing?
0
aviponugotiAuthor Commented:
When i say i can not change it i mean i am not supposed to change it the same function is being used at a lot of other places. I am looking for a work around.

Thanks
Avinash

0
justinbilligCommented:
Ok from what your getting at I can assume that the window that opens up the calender isn't modal. So the only way your going to have to get around this is a function on timeout

var g_intTimer
function ToggleButton( )
{
     formname.buttonname.disabled = FunctionThatValidatesTheDateInTheTextBox( );

    // Recall this function
    g_intTimer = setTimeout( "ToggleButton", 3000 );
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
aviponugotiAuthor Commented:
Hello guys,
     I think what justinbillig  suggested should work. But i already change my approch i made my button enable and onClick i am validating date inthe text field and depending upon the result the button performs its action. I am giving the points to justinbillig for giving a resonable answer.

Thanks
Avinash
0
aviponugotiAuthor Commented:
On second thought i am splitting the points just for trying to help.
Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.