Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Save Parameters to Text File, and then pass parameters to further text fields in form for further information to be added

Posted on 2004-03-29
5
Medium Priority
?
233 Views
Last Modified: 2010-04-06
I am relatively new to scripting and would like to have the user enter a parameter into a text field, for that data to be saved to a text file, and then be able to pass those parameters to another form.  I suppose that this is similar to a cookie, but don't want to use that method.

Also I am unsure how it will be best to script this, I have basic knowledge in ASP and Javascript and would like to use either of these technologies.

I would therefore appreciate some pointers/possible code on how to complete this.

Many Thanks
0
Comment
Question by:ITgirl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10705946
>>>I suppose that this is similar to a cookie, but don't want to use that method.

The cookie method was developed because you can't do what you want to do.  Ordinary web pages are not permitted to access the the client's hard disk except for caching and cookies, and those may or may not be available depending on user preferences.  Even with risky elements like activex you have to have the users permission.  You cannot just write things out the hard drive.

If you need intemediate processing do it on the server. Send the first page to a script that saves the information server side and generates the next part of the form with the parameters included.

Cd&
0
 
LVL 1

Author Comment

by:ITgirl
ID: 10706666
Ok so may be I didn't make myself clear - this is for client side (on an intranet) where the user has full knowledge of the file being saved.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10709117
Save a file clientside with partial contents of a page:

- Create a hidden iframe anywhre on the page:
<iframe name="fHidden" style="position:absolute;visibility:hidden;" src="about:blank"></iframe>

- add following script to the head of the page
<script type="text/javascript">
function saveContent(sText)
{
   document.frames['fhidden'].document.body.innerHTML = sText;
   document.frames['fhidden'].document.execCommand("SaveAs");
  return true;
}
</script>



Then call it this way from the form tag:

<form name="yourform" action="yourscript.asp"
onsubmit="saveContent(document.forms['yourform'].yourtextfield.value)";

The user will get a dialog and must agree to the data being saved on their hard drive. After the file has been saved the form action will be executed

Cd&
 


0
 
LVL 1

Author Comment

by:ITgirl
ID: 10714101
As I previously mentioned I am quite new to scripting - is there any way this can be done in javascript - as I am a bit happier using Javascript than asp.

Thanks
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 150 total points
ID: 10714806
The form processing has to be done with server side scripting.  You cannot process it with the client side javascript.  The response page with the parameters carried over has to be generated on the server.

Cd&
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question