Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 24th, 2009, 10:07 AM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
Default contact form

I have used your method detailed in your book to set up a working contact form for my website (thank you) but I have 2 questions regarding how you have done this.

Firstly If someone enters a long message in the Message box then it still all displays on one line is there a way to get around this and format it slightly better in the text file?

Secondly you have used a table to layout the form I assume this is only because it was outside the scope of this section to explain the CSS for it. Anyway I am trying to lay my form out using CSS and I have run into a few problems.

You can see the contact page here. It was all inline and nice until I added Validation controls. These seem to have thrown it out of alignment and I am wondering how to target them in CSS to get them to display alongside the textboxes on the right so the form goes back to displaying as normal.

It currently doesn't display a confirmation of when a message has been sent and I have set it up to send to an email address that I don't use so don't be worried about sending a useless message to me if you end up having a look at it for me.

Help would be very appreciated Thanks.
 
Old February 24th, 2009, 11:44 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Will,

The e-mail you're sending is in HTML format (if you're following along with the book). This means you need to convert regular line breaks to break tags before you assign the body:

body = txtBody.Text.Replace("\r\n", "<br />\r\n")

This converts normal line breaks (\r\n) in HTML breaks.

With regards to your other question: what happens if you don't set the float of the error message to right, but to none instead? I tried that using the IE Dev Toolbar and it caused the asterisks to float to the immediate right of the input controls.

You can see a table-less implementation of a similar contact form I just did here: http://www.dotnetattributes.com/Contact/

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old February 24th, 2009, 12:50 PM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
Default

When I take the float: right; out it goes all out of alignment in firefox completley which is why I put it in there. I am studying your Contact me form now to see if I can fix it using that.

But still stuck so if you can speculate any further on possible problems it is much appreciated.
 
Old February 24th, 2009, 01:01 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Instead of taking it out, did you try setting it none? That's what I did and what seemed to work.

Let me know if that helps; if it doesn't, I'll take another look. In that case, can you send me the plain HTML and CSS files through my profile?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old February 24th, 2009, 01:20 PM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
Default

Thank you again that worked perfectly.

What does \r\n represent as I see that instead of just replacing \r\n with <br> you are replacing it <br>\r\n if I understood the code correctly?
 
Old February 24th, 2009, 01:39 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

\r\n represents a carriage return and a line break combination. Replacing it for <br />\r\n is actually a force of habit to keep the source readable.

Consider this text:

The quick brown fox
jumps over the lazy dog.

There's a \r\n between fox and jumps. If you simply replace it with <br /> you end up with:

The quick brown fox<br />jumps over the lazy dog.

For HTML capable viewers, this doesn't really matter. They still display it as

The quick brown fox
jumps over the lazy dog.

But if you need to debug the HTML and look in the source, it's easier to understand if you see this:

The quick brown fox<br />
jumps over the lazy dog.

It just helps me to better understand the final result, but it has no influence on that final result.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old February 24th, 2009, 01:42 PM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
Default

Thank you again.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Error With Contact Form ASP.NET 3.5 CSharpCoder BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 July 28th, 2008 04:08 PM
Contact Form and Gmail Jamessaep BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 April 16th, 2008 07:58 AM
Contact form XML attachments. retroviz BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 March 16th, 2008 09:52 AM
Contact Form myself Classic ASP Basics 1 November 18th, 2006 11:16 AM
PHP contact form probe4 PHP How-To 1 September 14th, 2005 12:52 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.