[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 151
  • Last Modified:

HTML Formatting Question

I need to recreate the following in HTML:

Name:  ___________________________________________
              Last                 First                 Middle

I can create the words just fine, it's the line I'm having issues with.  Is there a line drawing functionality of this software other than the horizontal rule?
0
johnson00
Asked:
johnson00
  • 4
  • 4
  • 2
  • +1
1 Solution
 
mrichmonCommented:
You can use CSS or you  can use table borders

Is this for an online form (i.e. input boxes will be involved) or for a printed form

With CSS (or a tbale) the bet way to go about it is to have an object (such as a div or table cell) and then add the bottom border with a style like:

border-bottom: solid black 1px;
0
 
johnson00Author Commented:
Well, I tried that. The issue here is that this HTML page is collecting data from  a form and emailing the data in straight HTML format.  I can get it to print a text box that contains the data, but I really just need to place that data on top of a line.  CSS style works just fine when I preview the file, but when email is generated, the lines are lost. Any other suggestions?
0
 
mrichmonCommented:
The lines will be lost no matter what in a text based email

In HTML email - it depends on how much HTML the email client supports.

SOme email clients support limited HTML - some support full HTML and CSS - some support nothing.

Can you post the code that you are using to generate the email?
0
How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

 
johnson00Author Commented:
would you like to see the ASP code that replaces lines of text in the HTML page, or would you like to see the HTML page that's actually being emailed?
0
 
mrichmonCommented:
maybe both?
0
 
johnson00Author Commented:
Here's the ASP code:

<%
Dim strDate
Dim strSSN
Dim strLastName
Dim strFirstName
Dim strMiddleName
Dim strPosition
Dim strAdvertisement
Dim strEmpAgency
Dim strFriendRelative
Dim strWeb
Dim strEmployee
Dim strOther
Dim strEmail
Dim strAddress
Dim strCity
Dim strState
Dim strZip
Dim strPhone
Dim strEmployed


strDate       = request.form("Date")
strSSN        = request.form("SSN")
strLastName   = request.form("LastName")
strFirstName  = request.form("FirstName")
strMiddleName = request.form("MiddleName")
strPosition   = request.form("Position")
strEmail      = request.form("Email")
strAddress    = request.form("Address")
strCity       = request.form("City")
strState      = request.form("State")
strZip        = request.form("Zip")
strPhone      = request.form("Phone")
strEmployed   = request.form("SCEmployed")

' set the Check box variables
if not request.form("Advertisement")  = "" then strAdvertisement  = "checked"
if not request.form("EmpAgency")      = "" then strEmpAgency      = "checked"
if not request.form("FriendRelative") = "" then strFriendRelative = "checked"
if not request.form("WEB")            = "" then strWeb            = "checked"
if not request.form("Employee")       = "" then strEmployee       = "checked"
if not request.form("Other")          = "" then strOther          = "checked"


Function generateHTML(filename)
  Dim objFSO
  Dim objTStream
  Dim strText
  Const ForReading = 1

  Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    Set objTStream = objFSO.OpenTextFile(Server.MapPath(filename), ForReading) ' open up the template file for reading
      strText = objTStream.ReadAll ' read all of the file into strText variable
    Set objTStream = Nothing ' Clean up.... we dont need the file open anymore
  Set objFSO = Nothing ' Always clean up after you  ;)

  ' Replace all the placeholders in the template
  strText = Replace(strText, "#### DATE ####", strDate)
  strText = Replace(strText, "#### SSN ####", strSSN)
  strText = Replace(strText, "#### LASTNAME ####", strLastName)
  strText = Replace(strText, "#### FIRSTNAME ####", strFirstName)
  strText = Replace(strText, "#### MIDDLENAME ####", strMiddleName)
  strText = Replace(strText, "#### POSITION ####", strPosition)
  strText = Replace(strText, "#### ADVERTISEMENT ####", strAdvertisement)
  strText = Replace(strText, "#### EMPAGENCY ####", strEmpAgency)
  strText = Replace(strText, "#### FRIENDRELATIVE ####", strFriendRelative)
  strText = Replace(strText, "#### WEB ####", strWeb)
  strText = Replace(strText, "#### EMPLOYEE ####", strEmployee)
  strText = Replace(strText, "#### OTHER ####", strOther)
  strText = Replace(strText, "#### EMAIL ####", strEmail)
  strText = Replace(strText, "#### ADDRESS ####", strAddress)
  strText = Replace(strText, "#### CITY ####", strCity)
  strText = Replace(strText, "#### STATE ####", strState)  
  strText = Replace(strText, "#### ZIP ####", strzip)  
  strText = Replace(strText, "#### PHONE ####", strPhone)
 
  ' How to set the radio boxes   - this is just one of em
  if strEmployed = "TRUE" then
      strText = Replace(strText, "#### SCEMPLOYED_TRUE ####", "checked")
       strText = Replace(strText, "#### SCEMPLOYED_FALSE ####", "")
  else
      strText = Replace(strText, "#### SCEMPLOYED_TRUE ####", "")
       strText = Replace(strText, "#### SCEMPLOYED_FALSE ####", "checked")  
  end if

  '   ############################### THE REST OF THE FIELDS NEED ADDING NOW (GULP) ##################################

  ' Send back the finished HTML string
  generateHTML = strText
End Function

' Now email HR with the app using the template you set up.
Set objEmail = Server.CreateObject("CDONTS.NewMail")
  objEmail.BodyFormat = 0  ' CdoBodyFormatHTML  
  objEmail.MailFormat = 0  ' CdoMailFormatMime
  objEmail.From = strEmail ' who the email is from
  objEmail.To = strEmail   ' Who the email is going to
  objEmail.Subject = "New application"
  objEmail.Body = generateHTML("template.htm")
  objEmail.Send
Set objEmail = Nothing

%>

<html>
<head><title>results</title></head>

<body>
Email sent (we hope)
</body>
</html>

This code replaces identified text in an html form and emails that html form in html format.
0
 
johnson00Author Commented:
Here's the HTML code.  I've set up a class called borders that just creates a bottom border to the table cell.  I still have some text fields in here too, as I'm trying to get around having to use them.  Unfortunately, without either the text boxes or the lines under the text, what's returned via email is just too hard to read!

<p><strong>Date:</strong> <span class="borders">#### DATE ####</span></p>
<table width="100%"  border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="bottom"><strong>Name:</strong></td>
    <td valign="bottom"><form name="form1" method="post" action="">
      <input name="LastName" type="text" id="LastName" value="#### LASTNAME ####">
    </form></td>
    <td valign="bottom"><form name="form2" method="post" action="">
      <input name="FirstName" type="text" id="FirstName" value="#### FIRSTNAME ####">
    </form></td>
    <td valign="bottom"><form name="form3" method="post" action="">
      <input name="MiddleName" type="text" id="MiddleName" value="#### MIDDLENAME ####">
    </form></td>
    <td valign="bottom"><strong>Social Security #: </strong></td>
    <td valign="bottom" class="borders">#### SSN #### </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td valign="top">Last</td>
    <td valign="top">First</td>
    <td valign="top">Middle</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="100%"  border="0">
  <tr>
    <td width="22%"><strong>Position(s) Applied for: </strong></td>
    <td width="78%" class="borders">#### POSITION #### </td>
  </tr>
</table>
<table width="100%"  border="0">
  <tr>
    <td><strong>Referral Source: </strong></td>
    <td><FONT FACE="verdana, Helvetica, sans-serif">
      <INPUT TYPE="checkbox" NAME="Advertisement" VALUE="TRUE" #### ADVERTISEMENT ####>
</FONT>      <span class="style2">Advertisement</span></td>
    <td><FONT FACE="verdana, Helvetica, sans-serif">
      <INPUT TYPE="checkbox" NAME="EmpAgency" VALUE="TRUE" #### EMPAGENCY ####>
</FONT>      <span class="style2">Employment Agency</span></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><font face="verdana, Helvetica, sans-serif">
      <input type="checkbox" name="FriendRelative" value="TRUE" #### FRIENDRELATIVE ####>
</font>      <span class="style2">Friend/Relative</span></td>
    <td><input name="WEB" type="checkbox" id="WEB" value="TRUE" #### WEB ####>
Website</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><FONT FACE="verdana, Helvetica, sans-serif">
      <INPUT TYPE="checkbox" NAME="Employee" VALUE="TRUE" #### EMPLOYEE ####>
</FONT>      <span class="style2">Employee</span></td>
    <td><FONT FACE="verdana, Helvetica, sans-serif">
      <INPUT TYPE="checkbox" NAME="Other" VALUE="TRUE" #### OTHER ####>
</FONT>      <span class="style2">Other</span></td>
  </tr>
</table>
<table width="100%"  border="0">
  <tr>
    <td><strong>Address:</strong></td>
    <td class="borders">#### ADDRESS #### </td>
    <td class="borders">#### CITY #### </td>
    <td class="borders">#### STATE #### </td>
    <td class="borders">#### ZIP #### </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>Street</td>
    <td>City</td>
    <td>State</td>
    <td>Zip</td>
  </tr>
</table>
<table width="43%"  border="0">
  <tr>
    <td width="43%"><strong>Telephone Number: </strong></td>
    <td width="57%" valign="bottom" class="borders">#### PHONE #### </td>
  </tr>
</table>
<hr width="100%">
<table width="100%"  border="0">
  <tr>
    <td><strong>Have you ever been employed by Springfield Clinic? </strong></td>
    <td><FONT FACE="verdana, Helvetica, sans-serif">
      <INPUT TYPE="radio" NAME="SCEmployed" VALUE="TRUE" #### SCEMPLOYED_TRUE #### >
Yes </FONT></td>
    <td><FONT FACE="verdana, Helvetica, sans-serif">
      <INPUT TYPE="radio" NAME="SCEmployed" VALUE="FALSE" #### SCEMPLOYED_FALSE ####>
No</FONT></td>
    <td>If Yes, </td>
  </tr>
</table>
<p>&nbsp;</p>
<p>&nbsp; </p>
</body>
</html>
0
 
mrichmonCommented:
I don't see the class definitions in the generated HTML code.

You will need to either include a stylesheet or embed the styles (probably the better option) into the email messge HTML so that email clients that do understand how to render the HTML with CSS can find the class definitions to do so.
0
 
minichickenCommented:
To create:
Name:  ___________________________________________
              Last                First                Middle

in HTML:

**************************************************************************

<table width="50%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>Name:</td>
    <td colspan="3" style="border-bottom-width:1px; border-bottom-color:#333333; border-bottom-style:solid">&nbsp;</td>
  </tr>
  <tr>
    <td width="7%">&nbsp;</td>
    <td width="31%" align="center">Last</td>
    <td width="31%" align="center">First</td>
    <td width="31%" align="center">Middle</td>
  </tr>
</table>
0
 
chief77Commented:
Why not just use <u> for underline? quick and easy, and it is what he is looking for. a line under the text :-)

hehe

Kel
0
 
minichickenCommented:
If you use <u> it will only underline when there are characters, if there are no characters, then there will be no underline....
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 4
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now