Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
Ron McLeod
paul wheaton
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Himai Minh
Bartenders:
Forum:
JSP
How to enable/disable buttong based on session variable
Alka ravi
Greenhorn
Posts: 7
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
<html> <head> </head> <body> <script language="JavaScript"> <!-- function check_extension(filename, uploadButton) { var validFilesTypes = ["xlsx","xls"]; var submitButton = document.getElementById(uploadButton); var ext = filename.substring(filename.lastIndexOf(".") + 1, filename.length).toLowerCase(); for (var i = 0; i < validFilesTypes.length; i++) { if (ext==validFilesTypes[i]) { submitButton.disabled = false; return true; } } alert("Invalid filename, please select another file"); submitButton.disabled = true; } --> </script> if (Session["url"] != null) { ImportButton.disabled = false; var filename = Session["url"]; Session.Contents.Remove(url) } else { ImportButton.disabled = true; } <form name="form1"> Please choose a file. <input type="file" name="uploadbox" size="35" onChange='check_extension(this.value, "UploadButton")'> <br> <br> <input type="submit" id="UploadButton" value="Upload" disabled="disabled"/> <input type="submit" id="ImportButton" value="Import" disabled="disabled"/> <input type="submit" id="CloseButton" value="Close" onClick='window.close()'/> </form> </body> </html>
Above is just a sample code in html. i want to enable/disable button based on session variable URL. Also, is the clearing logic for session variable is correct?
Bear Bibeault
Sheriff
Posts: 67754
173
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
JavaScript has no access to the server-side session. Where did you find this API that you are using?
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Editable form
disable anchor tags on printable page
making the textbox readonly
disable submit button help
disable other textfield as one textfield entered
More...