Save Form Data to file

Save Form Data to file

am 17.01.2008 14:21:17 von glbdev

Hello.

Does anyone have any example code of how to save a form, once it is
submitted, as a text document? What I mean is that I want to save
the form (with HTML tags) to a text file which I can than eMail to the
person who filled out the form.

I looked around but I can't really find a good example of this.

Any help would be appreciated.

Thanks,
Steve

Re: Save Form Data to file

am 17.01.2008 17:03:10 von Courtney

wrote in message
news:ebc5a750-61d0-455d-bb0c-70e8588f9c7c@x69g2000hsx.google groups.com...
> Hello.
>
> Does anyone have any example code of how to save a form, once it is
> submitted, as a text document? What I mean is that I want to save
> the form (with HTML tags) to a text file which I can than eMail to the
> person who filled out the form.
>
> I looked around but I can't really find a good example of this.
>
> Any help would be appreciated.
>
> Thanks,
> Steve

You could use Javascript to get the html between the body tags. Then either
set a hidden text field to the html and let the page handle the save of the
file and the email or write a web service to take the hmtl and save the file
and email it to the user.

Hope this helps
Lloyd Sheen

Re: Save Form Data to file

am 17.01.2008 17:25:33 von glbdev

On Jan 17, 11:03=A0am, "Lloyd Sheen" wrote:
> wrote in message
>
> news:ebc5a750-61d0-455d-bb0c-70e8588f9c7c@x69g2000hsx.google groups.com...
>
> > Hello.
>
> > Does anyone have any example code of how to save a form, once it is
> > submitted, as a text document? =A0 What I mean is that I want to save
> > the form (with HTML tags) to a text file which I can than eMail to the
> > person who filled out the form.
>
> > I looked around but I can't really find a good example of this.
>
> > Any help would be appreciated.
>
> > Thanks,
> > Steve
>
> You could use Javascript to get the html between the body tags. =A0Then ei=
ther
> set a hidden text field to the html and let the page handle the save of th=
e
> file and the email or write a web service to take the hmtl and save the fi=
le
> and email it to the user.
>
> Hope this helps
> Lloyd Sheen


Thanks for responding. I am not sure how to do this. Do you know of
a link or something that could help?

Steve

Re: Save Form Data to file

am 17.01.2008 20:20:55 von Courtney

wrote in message
news:f3f1b49c-aec8-4310-83ad-853201197382@x69g2000hsx.google groups.com...
On Jan 17, 11:03 am, "Lloyd Sheen" wrote:
> wrote in message
>
> news:ebc5a750-61d0-455d-bb0c-70e8588f9c7c@x69g2000hsx.google groups.com...
>
> > Hello.
>
> > Does anyone have any example code of how to save a form, once it is
> > submitted, as a text document? What I mean is that I want to save
> > the form (with HTML tags) to a text file which I can than eMail to the
> > person who filled out the form.
>
> > I looked around but I can't really find a good example of this.
>
> > Any help would be appreciated.
>
> > Thanks,
> > Steve
>
> You could use Javascript to get the html between the body tags. Then
> either
> set a hidden text field to the html and let the page handle the save of
> the
> file and the email or write a web service to take the hmtl and save the
> file
> and email it to the user.
>
> Hope this helps
> Lloyd Sheen


Thanks for responding. I am not sure how to do this. Do you know of
a link or something that could help?

Steve

Steve,

I am including some code as a sample:

First is the code for a sample page. The important part is the
validateRequest="false" which is part of the @Page tag. Since you will be
placing HTML into a hidden field ASP.NET will check these field to ensure
that hackers are not messing up your HMTL. In this example and perhaps in
what you are doing this is ok to set to false since you know that it is you
that is doing this.

This is the markup for the page.


<%@ Page Language="VB" validateRequest="false" debug="true"
AutoEventWireup="false" CodeFile="TestGetHTML.aspx.vb"
Inherits="TestGetHTML" %>

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



Untitled Page






















Cell 1 Some text
The middle
Cell3 Somemore text






OnClientClick="SetHMTLToHidden();" Text="Button" />






This is a sample of a code behind which gets the HTML from the hidden field
and then you do with it as you want.



Partial Class TestGetHTML
Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim txt As String
txt = Me.HiddenField1.Value

End Sub
End Class

Hope this helps
Lloyd Sheen

Re: Save Form Data to file

am 17.01.2008 20:51:27 von glbdev

Thanks Lloyd!! I will try this out.

Steve

Lloyd Sheen wrote:
> wrote in message
> news:f3f1b49c-aec8-4310-83ad-853201197382@x69g2000hsx.google groups.com...
> On Jan 17, 11:03 am, "Lloyd Sheen" wrote:
> > wrote in message
> >
> > news:ebc5a750-61d0-455d-bb0c-70e8588f9c7c@x69g2000hsx.google groups.com...
> >
> > > Hello.
> >
> > > Does anyone have any example code of how to save a form, once it is
> > > submitted, as a text document? What I mean is that I want to save
> > > the form (with HTML tags) to a text file which I can than eMail to the
> > > person who filled out the form.
> >
> > > I looked around but I can't really find a good example of this.
> >
> > > Any help would be appreciated.
> >
> > > Thanks,
> > > Steve
> >
> > You could use Javascript to get the html between the body tags. Then
> > either
> > set a hidden text field to the html and let the page handle the save of
> > the
> > file and the email or write a web service to take the hmtl and save the
> > file
> > and email it to the user.
> >
> > Hope this helps
> > Lloyd Sheen
>
>
> Thanks for responding. I am not sure how to do this. Do you know of
> a link or something that could help?
>
> Steve
>
> Steve,
>
> I am including some code as a sample:
>
> First is the code for a sample page. The important part is the
> validateRequest="false" which is part of the @Page tag. Since you will be
> placing HTML into a hidden field ASP.NET will check these field to ensure
> that hackers are not messing up your HMTL. In this example and perhaps in
> what you are doing this is ok to set to false since you know that it is you
> that is doing this.
>
> This is the markup for the page.
>
>
> <%@ Page Language="VB" validateRequest="false" debug="true"
> AutoEventWireup="false" CodeFile="TestGetHTML.aspx.vb"
> Inherits="TestGetHTML" %>
>
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
>
>
> Untitled Page
>
>
>
>
>


>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
Cell 1Some text
The middle
Cell3Somemore text

>

>
>

> > OnClientClick="SetHMTLToHidden();" Text="Button" />
>

>

>
>
>
>
> This is a sample of a code behind which gets the HTML from the hidden field
> and then you do with it as you want.
>
>
>
> Partial Class TestGetHTML
> Inherits System.Web.UI.Page
>
> Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> Dim txt As String
> txt = Me.HiddenField1.Value
>
> End Sub
> End Class
>
> Hope this helps
> Lloyd Sheen