Subject: remember dynamically built innerHTML on browser <-
Posted By: crmpicco Post Date: 2/2/2006 10:46:47 AM
When i click on a radio button on picco1.asp i call this JavaScript function (fillTxt) to dynamically build two text boxes.
Then when i click 'Submit' on the page it takes me to picco2.asp.
My problem is when i click BACK <- on the browser it clears the two new textboxes - they are not shown. Is there a way to make them more permanent?
One note is that i have three radio buttons, onclick of two of the button will hide the textboxes, but on click of the third one builds them....


function fillTxt(desc, state, oneWay)
{
switch (desc)
{        
   case "via" :
if (state == "on")
  {        
    via.innerHTML = '<font size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Via</b></font>&nbsp;<input type="text" tabindex="3" name="via" size="10"  value="" STYLE="color: black; font: 7pt Verdana, Arial, Helvetica, sans-serif;" />&nbsp;';
        }
        else if (state == "off")
        {
        via.innerHTML = '';        
        }
    break;
   
     case "OJ" :
         if (state == "on")
        {                
        ojHlpDep = "Type country or city to obtain stadium city code."
    ojHlpArr = "Type country or city to obtain stadium city code." 
        ojHlpClr = ""
        
    oJ1.innerHTML = '&nbsp;&nbsp;&nbsp;<font size="1" face="Verdana, Arial, Helvetica, sans-serif">From</font>&nbsp;';
    oJ2.innerHTML = '<input type="text" tabindex="4" name="dep2" size="10" value="" onChange="javascript:this.value=this.value.toUpperCase();departure_name();" onmouseover="javascript: message_help(ojHlpDep);" onmouseout="javascript: message_help(ojHlpClr);"  STYLE="color: black; font: 7pt Verdana, Arial, Helvetica, sans-serif;" onDblClick="javascript:destination();">'
    openJaw3.innerHTML = '&nbsp;<font size="1" face="Verdana, Arial, Helvetica, sans-serif">To</font>&nbsp;';
    openJaw4.innerHTML = '<input type="text" tabindex="5" name="ariapt2" size="10" value="" onChange="javascript:this.value=this.value.toUpperCase();destination_name();" onmouseover="javascript: message_help(ojHlpArr);" onmouseout="javascript: message_help(ojHlpClr);" STYLE="color: black; font: 7pt Verdana, Arial, Helvetica, sans-serif;" onDblClick="javascript:destination();" />'                                        
        }
        else if (state == "off")
        {
        oJ1.innerHTML = '';        
    oJ2.innerHTML = '';
    oJ3.innerHTML = '';
    oJ4.innerHTML = '';
    oJ5.innerHTML = '';
    oJ6.innerHTML = '';    
        via.innerHTML = '';                
        }
    break;
                
}                 
}


Help appreciated.

Picco

www.crmpicco.co.uk
Reply By: crmpicco Reply Date: 2/9/2006 8:51:53 AM
i have been advised that using a cookie would solve this problem, but is there any way of solving this without the use of setting, detecting and deleting a cookie?
are there any parameters that i could be setting/using when building the innerHTML above.

thanks.
(this looks like one for you vinod!)
picco

www.crmpicco.co.uk
Reply By: crmpicco Reply Date: 2/9/2006 8:52:32 AM
http://support.microsoft.com/default.aspx?scid=kb;en-us;319546

www.crmpicco.co.uk
Reply By: crmpicco Reply Date: 2/13/2006 6:53:49 AM
i have also been advised elsewhere that using window.name would be a good help, but with no explanation??? any ideas? input???

www.crmpicco.co.uk
Reply By: crmpicco Reply Date: 2/13/2006 6:55:00 AM
my problem with cookies is that the user could turn them off, which (i think) would mean either an error would occur or the page would not cache my innerHTML. either way not ideal.....

www.crmpicco.co.uk
Reply By: interrupt Reply Date: 2/13/2006 8:27:28 AM
Can't you write a textfile to store the data you want to store clientside like on their root C? (Not sure what you're writing for, commercial Internet, or network?) Obviously requires ActiveX use, which isn't really applicable if we're talking about an internet site.

Joe

Reply By: crmpicco Reply Date: 2/13/2006 9:02:46 AM
no, this isnt really viable either. is there no way to do it purely with SS-code?

www.crmpicco.co.uk
Reply By: crmpicco Reply Date: 2/13/2006 9:03:18 AM
(or CS-code) without writing files to the users PC. It is a intenet site BTW

www.crmpicco.co.uk
Reply By: crmpicco Reply Date: 2/14/2006 11:33:18 AM
with regard to the Cookie solution, if the user had cookies disabled within their browser settings....would my code not work? i.e. would it not remember the innerHTML?

www.crmpicco.co.uk
Reply By: ChrisScott Reply Date: 2/14/2006 11:56:34 AM
Quite correct Picco.

If this is not an option, one possible solution might be to use a frameset with one frame zero height, another containing your page.

You could store your changes using scripts in the hidden frame and check that frame on page load for any updates.

HTH,

Chris

Reply By: vinod_yadav1919 Reply Date: 2/15/2006 6:18:32 PM
Hii Crmpicco!!
Still there is a hope to solve it!! Let we do something.
1>Cookiess-user disabled cookies.

2>javascript variable-user refresh the page.

3>For each page submission or page unload save the data savePageSatus.asp(say)in temporary file.

(a)on page load check whether there is data for current_id and current_user.
  (current_id is unique random number,that is sufficient to find the data
   stored in txt/database or csv file for current_user and current page)
   (a.1)If no data is found then it is fresh page
   (a.2)If data is found then load the data which is previous value
       this is the case when user refresh the page.

(b)When user refresh the page ,load the current status(data)
  into temp file which can be database,csv file.

(c)When user submit the page ,before the actual form submission,
   (c.1) load all** the current status data into temp file.(??)<Since for some options,
your control disabled certain form field values which can't be retrieved in form submission page
,when user click on the submit button,so its not a good idea to save data only in the submission of
form.>
   (c.2)after loading the data ,save the actual data into actual database tables/files.

(d)When user click on the back button,might be he/she wants to make enable disabled
field values,So... ,on page load<since page was already loaded> get the values from
getPageSatus.asp(say) and load the data,set their corresonding values,create dynamic
tables,set their values using javascript etc.

(e)How to call savePageSatus.asp??
    (e.1)Either using iframe , I prefer using normal xmlhttp and activex object request.
    (e.2)Using Ajax you can achieve this ,yet I have not find the opportunity
    to work using Ajax.For more info plz visit
http://dev2dev.bea.com/pub/a/2006/01/ajax-back-button.html
http://dev2dev.bea.com/pub/a/2006/01/ajax-back-button.html?page=2

http://www.sitepoint.com/blogs/2005/10/28/bookmarks-and-back-button-history-for-ajax-apps/
http://codinginparadise.org/weblog/2005/08/ajax-tutorial-saving-session-across.html

Note-1>there must be some way to tell the user which values are actually submitted.
       we can put diff style colors or * for that.
     2>there must be one codition ,on occurence of which we want to save the data,
       e.g first time page is loaded and I just refresh the page without click of
      AddNew Table button which creates dynamic table and fields values.We can put
      this validation to avoid unconditionally call event of savePageSatus.asp
  Please let me know if you find any other techniques!!
Hope this will help you


Cheers :)

vinod
Reply By: sinus_ Reply Date: 10/10/2006 2:04:24 AM
you could store them in sessions instead of using cookies

beginning PHP!

Go to topic 50799

Return to index page 153
Return to index page 152
Return to index page 151
Return to index page 150
Return to index page 149
Return to index page 148
Return to index page 147
Return to index page 146
Return to index page 145
Return to index page 144