/    Sign up×
Community /Pin to ProfileBookmark

Users select options to write letter

Hello. Thanks in advance to anyone who can help out!

I am working on a code that would allow users to “assemble” a letter that has already been pre-written. The letter has 4 paragraphs total, and each paragraph has a 2 different options. That way, they can select which option they want for each paragraph, hit a button, and the letter assembles itself with the options they chose.

My vision for this (though I’m open to anything that gets the job done) is a drop down menu that has the different paragraph options. When they click which option they want, the “letter” form (which is a textarea box or something) is automatically filled in with that option. Then they go on to the next paragraph, until the whole letter is entered. They can then hit submit and send off the letter.

I have found some codes that are close, but since I don’t know JS (only html) I don’t know how to get them to do what I need.

Any thoughts? thanks SO much for any help and your time.
-Jordan

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@James_GatkaApr 25.2006 — Jordan:

Does your host support PHP? JavaScript can create the letter you outlined, but it's not well suited to send email. You'll need a server-side language to that, like PHP.
Copy linkTweet thisAlerts:
@jordanwarnerauthorApr 25.2006 — Hey James. Thanks so much for the reply.

I could support PHP, but I guess I'm not so concerned that they're able to actually email what comes up. I more just want to get the text of their selected letter to show, then they can copy & paste into their email program.

I suppose what I really need is the javascript to generate the text of the email, not to actually send the email. Sorry for the confusion.

Any thoughts on the coding? I appreciate it so much!

-Jordan
Copy linkTweet thisAlerts:
@James_GatkaApr 25.2006 — Jordan:

Oh, well, so you are going to use this offline. Okay. Please test this code AS IS. Copy all of it, then save it as an .html document.

And a HINT: Avoid the "any thoughts, any ideas" line. Just ask for help.

[CODE]<html>
<head>
<script type="text/javascript">

var paragraph = [];
paragraph['p1A'] = " This is the first paragraph in A style.nn";
paragraph['p1B'] = " This is the first paragraph in B style.nn";
paragraph['p2A'] = " This is the second paragraph in A style.nn";
paragraph['p2B'] = " This is the second paragraph in B style.nn";
paragraph['p3A'] = " This is the third paragraph in A style.nn";
paragraph['p3B'] = " This is the third paragraph in B style.nn";
paragraph['p4A'] = " This is the fourth paragraph in A style.nnYours truly,nnCompany Name";
paragraph['p4B'] = " This is the fourth paragraph in B style.nnYours truly,nnCompany Name";

function insertPara(nPara){

document.forms[0]['message'].value += paragraph[nPara];
}

</script>
</head>
<body>

<form>
<fieldset align='center' style='font-size:12pt;width:440px;padding:5px;background-color:honeydew'>
<legend style='font-size:14pt;color:darkblue;padding:3px'> Reply Form </legend>
<label>Name: <input type='text' name='recipient' size='25'></label>
<br>
<label>Email: <input type='text' name='email' size='25'></label>
<br>
<label>
<select onchange="insertPara(this.value)">
<option value=""> A Style </option>
<option value='p1A'> One A </option>
<option value='p2A'> Two A </option>
<option value='p3A'> Three A </option>
<option value='p4A'> Four A </option>
</select>
</label>
&nbsp;&nbsp;
<label>
<select onchange="insertPara(this.value)">
<option value=""> B Style </option>
<option value='p1B'> One B </option>
<option value='p2B'> Two B </option>
<option value='p3B'> Three B </option>
<option value='p4B'> Four B </option>
</select>
</label>
<br>
<label>Message:<br>
<textarea rows='12' cols='50' name='message'>
Greetings:

</textarea>
</label>
</fieldset>
</form>

</body>
</html>[/CODE]
Copy linkTweet thisAlerts:
@jordanwarnerauthorApr 25.2006 — James, thank you so much. That helps more than you know. Take care.
Copy linkTweet thisAlerts:
@James_GatkaApr 25.2006 — Jordan:

You're welcome. You too.
×

Success!

Help @jordanwarner spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...