PDA

View Full Version : Request for polish to complete an am6-email application


travisperkins
03-07-2006, 06:19 AM
The attachment for this is with the reply to this post.

A while back, I got a lot of help from the Forum in sorting out the ability to submit user input by email, so that I could use AM6 to create an educational application. This has evolved into being able to also ftp attached and supporting files.

Before posting the project back for those involved in the latter part, I wondered if there was any chance of getting help just sorting out the last few problems with the email part, so that at least that aspect of the functionality is complete. Please feel free to move this to the examples area for others.

Background:
The application has a number of pages, of which the two important ones for these issues are Page 2 (UserDeatailsBasic) and the last Page (Submit).

On Page 2, the Student enters in some information that is written to text files in \\AutoPlay\\Docs
Then, on the last page, when the Student hits '"Submit", this input is sent by email via a sendmail.php script on a remote server.

All is working well. But, I have two issues to resolve:

****

1. In order to get it working so that emails reveal the name of the input filed, in the form of:
Given Name: Peter
Family Name: Smith

instead of just data, in the form of:
Peter
Smith

I added the following code to the 'Save' button on Page 2 that updates the input fields:

sText = Input.GetText("GivenName")
TextFile.WriteFromString("Autoplay\\Docs\\InputGivenName.txt", "Given Name:" .. sText .."\n", false)
sText = Input.GetText("FamilyName")
TextFile.WriteFromString("Autoplay\\Docs\\InputFamilyName.txt", "Family Name:" .. sText .."\n", false)

However, the problem is that the names of the input fields (Given Name, Family Name) actually show up to the Student in the GUI input fields, instead of leaving the input fields blank or populated only with the Student input.

Secondly, this information is followed by a little square that I can not seem to get rid of and that is present even when I omit the name of the input fields from the strings cited above.

Thus, my first two questions are:

1. How can we stop the name of the input fields actually appearing to the Student on Page 2 of the front end?
2. How can we get rid of the little squares in the same place?

****

The other two issues relate to the last Page and the process of Submission.

At the moment, when you hit "Submit", the email is sent, but the Student has no idea at all from watching the screen. Secondly, the user does not receive an email letting them know that their information has been received. Rectifying the first is essential, I think. And if the latter could also be sorted, then that would be a bonus. We have already captured the user's email address on Page 2. Thus:

3. How is it possible to:
A. Show a progress bar while the email is being sent
B. Return an on screen message to confirm to the user that the email has been sent
C. Return an on screen message saying that the user is not connected to the internet if they are not
D. Return an on screen general error message if for some other reason the email is not sent
E. Send an email to the Student confirming their information has been received.

In case it helps, here is the php script as it currently stands:

<?php

$mail_to = $_REQUEST['mail_to'];
$subject = $_REQUEST['subject'];
$message = $_REQUEST['message'];
$mail_from = $_REQUEST['mail_from'];
$reply_to = $_REQUEST['reply_to'];

$headers = "From: $mail_from\r\n";
$headers .= "Reply-To: $reply_to\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";

mail(
$mail_to,
$subject,
$message,
$headers
);

?>

travisperkins
03-07-2006, 06:26 AM
Here is the attachment of the project for the post above.

Dermot
03-07-2006, 12:47 PM
It is very easy to return a message from your php script. Just add something like this to your script after the mail()

echo "Your information has been submited.\r\n\r\nThank you"

Then in your AMS app add this to the Submit button after the line the submits the info.

Dialog.Message("Response", sent)

This will display the message from the PHP script in a message box. You could add more logice to the PHP script to check that ir was actually sent and then return an appropriate message.

To let the user know something is going on when they submit, I would just add a hidden label to the page that says "Please wait" or something like that. When the submit button is clicked, make it visible and after the confirmation dialog message is displayed, hide it again.

yosik
03-08-2006, 12:03 AM
And as to your first 2 questions:
1. Try to use 2 sets of variables, one for the names only, one for the names preceded by their captions. Then on page 2, in the inputtext obkect (or whatever you are using) use the name only variables.

2. Are you, by any chance using a non-english font? Wouldn't this something to doo with the ":" and that font can't show it? Just a guess.

Yossi

travisperkins
03-08-2006, 12:43 AM
Hi Yosik...

Could you just elaborate slightly so I can use your advice.

Here is an example line from the input button that saves the user input:

*****
sText = Input.GetText("GivenName")
TextFile.WriteFromString("Autoplay\\Docs\\InputGivenName.txt", "Given Name:" .. sText .."\n", false)
*****

Then on the 'Submit Button, I have:

****
HTTP.Submit("http://www.karazoo.com/sendmail.php", myvalues, SUBMITWEB_GET, 20, 80, nil, nil);

sent = HTTP.Submit("http://www.karazoo.com/sendmail.php", {mail_to="biz@karazoo.com", subject=Subj, message=result, mail_from=name, headers="Whatever"}, SUBMITWEB_POST, 20, 80, nil, nil);
****

But I am not sure where else I would put a second set of variables and what they would be.

travisperkins
03-09-2006, 01:41 AM
Well, I have tried every combination of every variable I know, and whatever I do, the Name of the Input field shows up in the input with the little square.

Also, I notice that the Name of the input field is duplicated in the email, in the form of:

Given Name Given Name: Peter
Family Name Family Name: Smith

I have used exactly the examples I was shown here to formulate the input to email code.

Such a tiny thing yet so persistent and refuses to die. I have this horrible feeling that if I don't solve this soon I'll banned from the Forum :)

Anyone out there with any patience left ?