473,396 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to maintain session state using hidden fields?

Hi,

I have a org tree with hierarchical display of employees built using
classic asp and vbscript.

I also have list of radio buttons for report names.

I have 1 select box with dates in it.

Then I click on the submit button to view the reports in Crystal. But
when I come back, my org tree is now collapased

I store the employee clicked (radio button), report clicked (radio
button), date (drop down) in hidden fields on submit of the form.

Now when I come back, how can I use these hidden fields to store the
page state?

Please advise what other information you may need.

javascript that populates the text boxes.
Expand|Select|Wrap|Line Numbers
  1. function ValidateData(f) {
  2.  
  3. // Check to make sure Reporting Period is selected.
  4. if (f.period.value == "Select") {
  5. alert("Select a Reporting Period");
  6. f.period.focus();
  7. return false;
  8. }
  9.  
  10. //Check to make sure a report is selected.
  11. // validate myradiobuttons
  12. myOption = -1;
  13. for (i=f.crystalradio.length-1; i -1; i--) {
  14. if (f.crystalradio[i].checked) {
  15. myOption = i;
  16. }
  17. }
  18. if (myOption == -1) {
  19. alert("You must select a report to view");
  20. return false;
  21. }
  22.  
  23. var jPeriod = f.period.value;
  24. f.hPeriod.value = jPeriod;
  25. alert(jPeriod);
  26.  
  27. for (i=f.empid.length-1; i>-1; i--)
  28. {
  29. if (f.empid[i].checked)
  30. {
  31. f.hEmpID.value = f.empid[i].value;
  32. alert(f.hEmpID.value);
  33. }
  34. }
  35.  
  36. for (i=f.crystalradio.length-1;i>-1;i--)
  37. {
  38. if (f.crystalradio[i].checked)
  39. {
  40. f.hCrystalRadio.value = f.crystalradio[i].value;
  41. alert(f.hCrystalRadio.value);
  42. }
  43. }
  44. }
  45.  
the textboxes in html:

Expand|Select|Wrap|Line Numbers
  1. <input type="text" name="hEmpID" value="">
  2. <input type="text" name="hCrystalRadio" value="">
  3. <input type="text" name="hPeriod" value="">
  4.  
Thanks.

Feb 1 '07 #1
1 7709
"zwieback89" <pa*******@gmail.comwrote in message
news:11**********************@j27g2000cwj.googlegr oups.com...
Hi,

I have a org tree with hierarchical display of employees built using
classic asp and vbscript.

I also have list of radio buttons for report names.

I have 1 select box with dates in it.

Then I click on the submit button to view the reports in Crystal. But
when I come back, my org tree is now collapased

I store the employee clicked (radio button), report clicked (radio
button), date (drop down) in hidden fields on submit of the form.

Now when I come back, how can I use these hidden fields to store the
page state?

Please advise what other information you may need.

javascript that populates the text boxes.
Expand|Select|Wrap|Line Numbers
  1. function ValidateData(f) {
  2. // Check to make sure Reporting Period is selected.
  3. if (f.period.value == "Select") {
  4. alert("Select a Reporting Period");
  5. f.period.focus();
  6. return false;
  7. }
  8. //Check to make sure a report is selected.
  9. // validate myradiobuttons
  10. myOption = -1;
  11. for (i=f.crystalradio.length-1; i -1; i--) {
  12. if (f.crystalradio[i].checked) {
  13. myOption = i;
  14. }
  15. }
  16. if (myOption == -1) {
  17. alert("You must select a report to view");
  18. return false;
  19. }
  20. var jPeriod = f.period.value;
  21. f.hPeriod.value = jPeriod;
  22. alert(jPeriod);
  23. for (i=f.empid.length-1; i>-1; i--)
  24. {
  25. if (f.empid[i].checked)
  26. {
  27. f.hEmpID.value = f.empid[i].value;
  28. alert(f.hEmpID.value);
  29. }
  30. }
  31. for (i=f.crystalradio.length-1;i>-1;i--)
  32. {
  33. if (f.crystalradio[i].checked)
  34. {
  35. f.hCrystalRadio.value = f.crystalradio[i].value;
  36. alert(f.hCrystalRadio.value);
  37. }
  38. }
  39. }
  40.  

the textboxes in html:

Expand|Select|Wrap|Line Numbers
  1. <input type="text" name="hEmpID" value="">
  2. <input type="text" name="hCrystalRadio" value="">
  3. <input type="text" name="hPeriod" value="">
  4.  

Thanks.
Classic ASP is not stateful. You will need to set the values back after
posting. The way I accomplish this is to use ASP to write my client-side
code.

Ex.

This:

sub prt(str)
Response.Write str & vbCrLf
end sub

prt "<script type=""text/javascript"">"
prt "function ..."
prt "..."
prt "</script>"

Not this:

%>
<script type="text/javascript">
function ...
....
</script>

This way I can fill in server side values that will get passed to the
client.
You can always mix server script within but I find it to be slower and more
difficult to read.

HTH...

--
Roland Hall
Feb 2 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: | last post by:
This is a very open ended question. I have an app with a page that uses link buttons to change the display. On the prior page you have a list of objects. You click one of those objects to see it's...
3
by: Terri | last post by:
Hi All, I'd like to build a series of pages with next and back buttons that a user could enter data in. I'd like the data to be maintained if for example the user goes from page1 to page2 and...
6
by: John | last post by:
Ok, so Session is less than desirable, at least that's what I'm always reading. So what are real, practical alternatives? Querystrings? an endless chain of hidden form fields?? Here are the...
7
by: Seth | last post by:
I have noticed that the id of my session object changes when I switch from a non-secure to a secure connection. What I'm trying to do: I have a cookie that is built on the non-secure side of...
5
by: Dominic | last post by:
My question is about how to maintain view state in mobile ASP.NET across postback / request in a web farm environment. First of all, let's assume the web-farm does NOT use stick-session feature....
7
by: Tom wilson | last post by:
I have created a very simple example that doesn't work. Form1 contains a textbox and a button: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
11
by: Joseph Geretz | last post by:
I've been looking at two approaches for the maintenance of Session state for a Web Service application. One approach uses the old familiar Session object which I've used in the past for Web...
11
by: Glenn | last post by:
Hi I've been experimenting with managing state using the Session object. I've created a simple WS with a couple of methods, one which sets a string value, another that retrieves it. Each...
0
by: chandrasekhar | last post by:
Hi I have developed a web page with some controls. I put all of them in session variables. I passed this values in the page. When an user enter some data in form fields and click the buttton ,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.