This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes HTML, CSS and JavaScript and the fly likes Question on using jQuery's .attr AFTER form is submitted Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply locked New topic
Author

Question on using jQuery's .attr AFTER form is submitted

Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 387

I am using jQuery 1.4.3. In the following function I am setting a dropdown list to a DISABLED attribute as follows:



The issue is that when the form is SUBMITTED, the dropdown list becomes ENABLED for some reason if there is an error on the form. I need the dropdown list to maintain the DISABLED attribute AFTER the form is submitted. Am I doing something wrong in the code above that would alter the attribute after the form is submitted?

I tried creating a .submit function to validate a multitude a fields in my form but I don't know how to get the attribute of the dropdown list. Can someone please tell me how to do this?

Any suggestions/direction would be appreciated. Thank you.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

After the form is submitted, the page ceases to exist. I assume that after the servlet that processes the form is finished, that the same JSP page is displayed again?

If so, then you are getting a fresh page from the server that has nothing whatsoever to do with what went on the previous time that the page was displayed.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 387

Bear,

Thanks for the reply. Based on your response I will post my next question regarding .submit(). Thanks again.
 
 
subject: Question on using jQuery's .attr AFTER form is submitted