Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Running Javascript when form posts back to user

 
Meghna Bhardwaj
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

I have 2 drop down lists A and B. The drop down list B must only be activated when from drop down A option 1 is chosen (for all other options chosen list B must be inactive). I have implemented this by calling a js function when list A changes as below:


This works just fine, but there is one scenario where it does not. This happens when the user selects option 1 from list A - this enables list B and the user can select an option there too. However after processing the request when the form posts back, list A still shows option 1 selected - but list B is disabled. The user then needs to change list A and reselect option 1 only then list B becomes active. So I need to also run my js function when the form posts back everytime - does anyone know how I can do this?

Any help much appreciated.

Regards.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would have the server do this if I alreasy know that user selected values. I would not rely on the clientside code to fill it in.


But if you want to do something about it...you could do something like
 
Meghna Bhardwaj
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much, just tried it ... works perfectly!

Regards.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic