Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Form + write to file
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
MonaA  
View profile  
 More options Jun 8 2011, 9:31 am
From: MonaA <mona.about...@gmail.com>
Date: Wed, 8 Jun 2011 06:31:01 -0700 (PDT)
Local: Wed, Jun 8 2011 9:31 am
Subject: Form + write to file
Hi guys,

So I finally got the writer and reader thing working in my iPad app.
However, I want the user to fill out a form and submit the content of
the form and place it in a text file. Then I would read the text file
and parse the information line by line and populate the information. I
can't seem to get the form information and write it to a file though.
Am I missing something?

Here is my code for javascript and HTML

<script type="text/javascript" charset="utf-8" src="phonegap.
0.9.5.1.min.js"></script>
 function onLoad() {
        document.addEventListener("deviceready", onDeviceReady,
false);
    }

    // PhoneGap is ready
    //
    function onDeviceReady() {
        window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS,
fail);
    }

    function gotFS(fileSystem) {
       fileSystem.root.getFile("info_account.txt",
{create:true,exclusive: false}, gotFileEntry, fail);
    }

  function gotFileEntry(fileEntry) {
        fileEntry.createWriter(gotFileWriter, fail);
    }

        function gotFileWriter(writer) {
        writer.onwrite = function(evt) {
            console.log("write success");
        };

                writer.write(document.forms.info[0].value+"\n");
                writer.write(document.forms.info[1].value+"\n");
                writer.write(document.forms.info[2].value+"\n");
                writer.write(document.forms.info[3].value+"\n");
    }

    function fail(evt) {
        console.log(evt.target.error.code);
    }

</script>

<body onload="onLoad()">

<form action="account.html" method="post" name="info" id="info">
        <h1>Account Manager</h1>
        <table>

                <tr>
                        <td>Practice / Company Name:
                        <input type="text" name="practicename" id="practicename" value=""></
td>
                </tr>

                <tr>
                        <td>First Name:
                        <input type="text" name="firstname" id="firstname" value=""></td>
                </tr>

                <tr>
                        <td>Last Name:
                        <input type="text" name="lastname" id="lastname" value=""></td>
                </tr>

                <tr>
                        <td>Email:
                        <input type="text" name="email" id="email" value=""></td>
                </tr>
                <tr>
                        <td><input type="submit"></td>
                </tr>
        </table>
        </form>

</body>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nick McCloud  
View profile  
 More options Jun 8 2011, 11:53 am
From: Nick McCloud <n...@descartes.co.uk>
Date: Wed, 8 Jun 2011 08:53:35 -0700 (PDT)
Local: Wed, Jun 8 2011 11:53 am
Subject: Re: Form + write to file
This bit: document.forms.info[0].value is wrong.

Try: document.forms[0]. practicename.value to get the practice name.

Also, I'd try using native local storage for html5 as it would be a
much simpler way to hold settings data.

On Jun 8, 2:31 pm, MonaA <mona.about...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
MonaA  
View profile  
 More options Jun 8 2011, 12:07 pm
From: MonaA <mona.about...@gmail.com>
Date: Wed, 8 Jun 2011 09:07:16 -0700 (PDT)
Local: Wed, Jun 8 2011 12:07 pm
Subject: Re: Form + write to file
I think the document.forms.info[0].value works fine. I alerted it and
the content from the form gets displayed properly. I tried your way
and nothing showed up. So I am not sure. Also, this local storage
thing didn't work. I got an example from the web and nothing
displayed. Does it work in phonegap? Have you ever tried it?

Thanks

On Jun 8, 11:53 am, Nick McCloud <n...@descartes.co.uk> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
MonaA  
View profile  
 More options Jun 8 2011, 12:44 pm
From: MonaA <mona.about...@gmail.com>
Date: Wed, 8 Jun 2011 09:44:52 -0700 (PDT)
Local: Wed, Jun 8 2011 12:44 pm
Subject: Re: Form + write to file
Never mind. I found another way and it finally works.. :) Thanks!

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »