HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 4th, 2004, 08:18 AM
jwlhtml jwlhtml is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 3 jwlhtml User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Web Form Question...

Sorry if this belongs in a different category, I'm just not sure what I need here...
Someone has created a web form for online registration in (I believe) ASP.NET. What I want to do is create the standard mandatory requirement: "you didn't insert a proper phone"/ "you didn't enter a valid email address". Is this something I can just add to the HTML code, or does it require further .NET coding? Here's what I have thus far, which works great, but does not actually require any of the fields to be completed...

<form method = "GET" action="/ASPNET/contactformresults.aspx" enctype ="text/plain" ID="Form1">
<input type=hidden name="Redirect" value="/submit/thanks.htm">
<table height="110" ID="Table1">
<tr>
<td height="15">Name: </td>
<td height="15"><input runat=server name="name" size="26" ID="Text1"></td>
</tr>
<tr>
<td height="15">Phone: </td>
<td height="15"><input name="phone" size="26" ID="Text4"></td>
</tr>

<tr>
<td height="15">Email: </td>
<td height="15"><input name="email" size="26" ID="Text5"></td>
</tr>
<tr>
<td height="15" colspan=2 align=right>
<input type = "submit" value="submit" ID="Submit1" NAME="Submit1">
</td>
</tr>

</table>
</form>

Reply With Quote
  #2  
Old March 4th, 2004, 08:23 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,770 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 7 h 8 m 6 sec
Reputation Power: 469
If it is in ASP.NET, then you can just use the built-in .NET Required Field Validation control. Alternately, you could write client-side javascript to validate the form.

Reply With Quote
  #3  
Old March 4th, 2004, 08:53 AM
jwlhtml jwlhtml is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 3 jwlhtml User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Javascript assistance requested...

Alright, just the database portion is in ASP.NET. So I'll have to go w/ jscript for the required field functionality. Could anyone point me to sample code for such functionality to get me started? I'm on my own on this one and have only dabbled in jscript for 10 minutes (2 years ago)!
Thanks,
John

Reply With Quote
  #4  
Old March 4th, 2004, 09:02 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,770 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 7 h 8 m 6 sec
Reputation Power: 469
Here's a simple example.
Code:
<script language="JavaScript">
function validateField(value, fieldName)
{
	if(value == '')
		alert(fieldName + " is required");
 		
}
</script>
<form name="form1">
<table height="110" ID="Table1"> 
<tr>
<td height="15">Name: </td>
<td height="15"><input runat=server name="txtName" size="26" onBlur="javascript:validateField(this.value, 'Name')"></td>
</tr>
<tr>
<td height="15">Phone: </td>
<td height="15"><input name="txtPhone" size="26" onBlur="javascript:validateField(this.value, 'Phone')"></td>
</tr>

<tr>
<td height="15">Email: </td>
<td height="15"><input name="txtEmail" size="26" onBlur="javascript:validateField(this.value, 'Email')"></td>
</tr>
<tr>
<td height="15" colspan=2 align=right>
<input type = "submit" value="submit" ID="Submit1" NAME="Submit1">
</td> 
</tr>
</table>
</form>

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > Web Form Question...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT