Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help refining a working script

Status
Not open for further replies.

crystalb24

Programmer
Aug 31, 2004
75
US
Here is the code that I'm using:

Code:
<script language="JavaScript">
function updateTextarea(cb)
{
 var taValue = document.formName.textareaName.value;
 if(cb.checked)
 {
  if(taValue != "")
   taValue += " ";

  taValue += cb.value; //APPENDS checked value to textarea
 }//end if
 else //checkbox is not checked
 {
  if(taValue.indexOf(cb.value) > -1)
  {
   taValue = taValue.replace(cb.value, "");//removes UNchecked value once
  }//end if
 }//end else

 taValue = taValue.replace(/\s+/g, " "); //reduces multiple spaces to single spaces
 if(taValue.indexOf(" ") == 0)
  taValue = taValue.substring(1);
 document.formName.textareaName.value = taValue;
}//end function
</script>

and

Code:
<form name="formName2" method="post" action="file:///G|/[URL unfurl="true"]wwwroot/PDGApps/AppFiles/ASPFiles/OnlineTraining/PCG/Fa_Rookie/MainMenu/Thanks.asp"[/URL] onsubmit="this.mission.value=this.textareaName.value;alert(this.mission.value);">
						<input type='hidden' name='mission'>
						<a name="textarea2"><TEXTAREA ROWS="10" COLS="65" name="textareaName2"></textarea></a>
						<p class="style20"><i>(insert best practice examples)</i></p>
						
						<table class="style20" width="100%">
							<tr>
								<td valign="top">
								<input type="checkbox" onclick="updateTextarea2(this);if(this.checked)showLink(this.name);" name="checkbox3" value="FORMATTING NEEDED">
								</td>
								<td colspan="2">
								Pre-meeting checklist
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td colspan="2">
								&bull;Schedule appointment; explain process
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td colspan="2">
								&bull;Send [letter/agenda/questionnaire] to client/prospect
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td>
								&nbsp;&nbsp;&bull;<i><a href="SAMPLE DOCUMENT.doc">(insert sample meeting letters)</a></i>
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td>
								&nbsp;&nbsp;&bull;<i><a href="SAMPLE DOCUMENT.doc">(insert sample agendas)</a></i>
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td>
								&nbsp;&nbsp;&bull;<i><a href="SAMPLE DOCUMENT.doc">(insert sample questionnaires)</a></i>
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td>
								&nbsp;&nbsp;&bull;<i><a href="SAMPLE DOCUMENT.doc">(insert sample information packets)</a></i>
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td colspan="2">
								&bull;Request send in / bring in documents
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td>
								&nbsp;&nbsp;&bull;<i><a href="SAMPLE DOCUMENT.doc">(insert sample document checklist)</a></i>
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td>
								&nbsp;&nbsp;&bull;If sending in, follow up process
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td>
								&nbsp;&nbsp;&bull;If sending in, review documents
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td colspan="2">
								&bull;Set up electronic & hard-copy files
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td colspan="2">
								&bull;Schedule team participants for <b><font color="#cc0000">Understand 
                your goals</font></b> meeting
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td colspan="2">
								&bull;Assemble materials needed for meeting
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td colspan="2">
								&bull;Facilities check<div id="checkbox3Div" style="visibility:hidden"><a href="#textarea2">Click here to return to top</a></div>
								</td>
							</tr>
						</table>
						<br>
						<br>						
						<table class="style20" width="100%">
							<tr>
								<td valign="top" valign="top">
						<input type="checkbox" onClick="updateTextarea2(this);if(this.checked)showLink(this.name);" name="checkbox4" value="FORMATTING NEEDED">
								</td>
								<td colspan="3">
								Agenda for <b><font color="#cc0000">Understanding Your Goals</font></b> meeting
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td colspan="3">
								&bull;<i><a href="SAMPLE DOCUMENT.doc">(insert sample agendas, questionnaires, discussion questions, scripts)</a></i>
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td colspan="3">
								&bull;Client goal information
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td colspan="2">
								&nbsp;&nbsp;&bull;Personal information for all members of household
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td colspan="2">
								&nbsp;&nbsp;&bull;Background, values and current financial situation
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td colspan="2">
								&nbsp;&nbsp;&bull;Identify goals (including $ required, time horizon, etc.)
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td>
								</td>
								<td>
								&nbsp;&nbsp;&nbsp;&nbsp;&bull;Retirement goals
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td>
								</td>
								<td>
								&nbsp;&nbsp;&nbsp;&nbsp;&bull;Education funding needs
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td>
								</td>
								<td>
								&nbsp;&nbsp;&nbsp;&nbsp;&bull;Special purpose goals
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td colspan="2">
								&nbsp;&nbsp;&bull;Liquidity needs
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td colspan="2">
								&nbsp;&nbsp;&bull;Capital preservation needs
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td colspan="2">
								&nbsp;&nbsp;&bull;Potential windfalls
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td colspan="2">
								&nbsp;&nbsp;&bull;Advanced topics
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td>
								</td>
								<td>
								&nbsp;&nbsp;&nbsp;&nbsp;&bull;Lending needs
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td>
								</td>
								<td>
								&nbsp;&nbsp;&nbsp;&nbsp;&bull;Wealth transfer requirements
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td>
								</td>
								<td>
								&nbsp;&nbsp;&nbsp;&nbsp;&bull;Special planning situations
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td>
								</td>
								<td>
								&nbsp;&nbsp;&nbsp;&nbsp;&bull;Life and other insurance coverage needs
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td>
								</td>
								<td>
								&nbsp;&nbsp;&nbsp;&nbsp;&bull;Other trusted advisors
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td colspan="2">
								&nbsp;&nbsp;&bull;Client's expectations
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td colspan="3">
								&bull;Client's risk information

								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td colspan="2">
								&nbsp;&nbsp;&bull;Discusssion of past investment experience
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td colspan="2">
								&nbsp;&nbsp;&bull;Discussion of historical ranges or returns
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td>
								</td>
								<td>
								&nbsp;&nbsp;&nbsp;&nbsp;&bull;<i><a href="SAMPLE DOCUMENT.doc">(insert samples of capital markets charts)</a></i>
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td colspan="2">
								&nbsp;&nbsp;&bull;Discussion of financial outlook
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td colspan="3">
								&bull;Client's current situation
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td colspan="2">
								&nbsp;&nbsp;&bull;Cash flow sources
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td colspan="2">
								&nbsp;&nbsp;&bull;Liquid assets, asset allocation
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td colspan="2">
								&nbsp;&nbsp;&bull;Non-liquid assets
								</td>
							</tr>
							<tr>
								<td>
								</td>
								<td>
								</td>
								<td colspan="2">
								&nbsp;&nbsp;&bull;Liabilities<div id="checkbox4Div" style="visibility:hidden"><a href="#textarea2">Click here to return to top</a></div>
								</td>
							</tr>
						</table>

What I need to be able to do is control the formatting of the text populating into the textarea. In order for the populated text to be removed from the textarea when the checkbox is unchecked, the value has to be contained on one line (I figured that out through trial and error). But I need the text designated by the checkbox (in this case a outline) to populate the way it looks on the screen, as an outline. Is there any way to do this?

~Crystal
Click here ( for a free iPod
 
What is your question?

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
Sorry, I didn't even notice that it didn't show up - my question is that with this script I want to be able to control the formatting of the text that populates into the textarea. Through trial and error I've discovered that in order to have the text removed when the checkbox is unchecked, the value field needs to be contained in one line, but I need the text represented by the checkbox, in this case an outline, to populate the way it appears on the screen, in outline form. Is this even possible?

~Crystal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top