[jQuery] Replace values in a string of text with content from form fields

[jQuery] Replace values in a string of text with content from form fields

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16414" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=471025718-27032007><FONT face=Arial size=2>I've been tasked
with building a Meta-Tags creator tool for my company. The user will be able to
type in a few pieces of information and have Meta tag information created for
them. The user will be able to choose from multiple generic paragraphs, all
set up roughly like this:</FONT></SPAN></DIV>
<DIV><SPAN class=471025718-27032007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=471025718-27032007><FONT face=Arial size=2>[dealerName] in
[city1], [stateAbv] has your [condition1] [brand1] [type1] or [brand1] [type2]
in stock.  From [city1] to [city5], and all over [region1], [dealerName] is
waiting for you to test drive you [condition1] [brand1].</FONT></SPAN></DIV>
<DIV><SPAN class=471025718-27032007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=471025718-27032007><FONT face=Arial size=2>There will be form
fields corresponding to each of these names in brackets. So the user will fill
out the appropriate fields, then select which text style they want. I'd like to
offer the user a live preview so that as they type in their values, any matching
value ([city1]) gets replaced with the value of the corresponding form
field.</FONT></SPAN></DIV>
<DIV><SPAN class=471025718-27032007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=471025718-27032007><FONT face=Arial size=2>My thought would be
to create several variables, each containing a generic paragraph, named
according to the value of that form field. </FONT></SPAN><SPAN
class=471025718-27032007><FONT face=Arial size=2>I'd write that paragraph to the
page (brackets and all). Then I'd create a function which loops through the form
and does a replace through the selected text string with the values from any
form field.</FONT></SPAN></DIV>
<DIV><SPAN class=471025718-27032007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=471025718-27032007><FONT face=Arial size=2>I think from a
coolness fact, I'd love to have it change AS the user types in the information,
but that's not a big deal. <SPAN class=471025718-27032007><FONT face=Arial
size=2>Anyone have a better idea?</FONT></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=471025718-27032007><FONT face=Arial size=2><SPAN
class=471025718-27032007></SPAN></FONT></SPAN> </DIV>
<DIV align=left><SPAN style="FONT-SIZE: 14px"><B><FONT face="Century Gothic">
<DIV align=left><SPAN class=159130414-05012007><FONT face=Arial size=2><SPAN
class=159130414-05012007><FONT face=Arial
size=2>____________________________________</FONT></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=159130414-05012007><FONT face=Arial size=2><SPAN
class=159130414-05012007></SPAN></FONT></SPAN> </DIV>Andy
Matthews<BR></FONT></B></SPAN><SPAN style="FONT-SIZE: 11px"><FONT
face="Century Gothic"><SPAN
style="FONT-SIZE: 8.5pt; FONT-FAMILY: 'Century Gothic'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes">Senior
Coldfusion Developer</SPAN><BR></FONT></SPAN><SPAN style="FONT-SIZE: 11px"><FONT
face="Century Gothic"><FONT color=#808080><IMG alt="" hspace=0
src="cid:471025718@27032007-0D61" border=0><BR></FONT>Office:  877.707.5467
x747<BR>Direct:  615.627.9747<BR>Fax:
 615.467.6249</FONT></SPAN></DIV>
<DIV><SPAN style="FONT-SIZE: 11px"><FONT
face="Century Gothic">amatthews@dealerskins.com<BR><A
href="http://www.dealerskins.com/">www.dealerskins.com</A></FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BODY></HTML>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/