Validation For Text Field
I need help regarding the string. In HTML page i have a text field to enter Name. How do i check whether its valid name or not, on the server side.
View RepliesI need help regarding the string. In HTML page i have a text field to enter Name. How do i check whether its valid name or not, on the server side.
View RepliesI'm looking for a script or direction to help to find a script (maybe java?) that will validate an email based on comparing it to another email text field. So when one enters an email and then "confirm email. The two entries must match. This form is .asp. This should be client side validation and not through my server.
View Replies View Relatedi know in html you can set a "max" character limit for a form field.I was wondering if it is possible to set a min number of characters?
View Replies View RelatedI've got a page whereby i need to make sure only one email address is entered. As multiple addresses causes havoc. Any ideas on how to approach this.
View Replies View RelatedWe have a shared hosting plan (Windows-based) with GoDaddy.com. GD.com has a
"generic" form mailer script (gdform.asp) that allows us to set up a
"Contact Us" page, which, when the user clicks "Submit" sends an email to
us.
I am a complete newbie re asp, but looking at the code, it looks to me as if
a error is generated if any of the fields are left blank--which is good. I
don't want to be getting emails that don't contain messages, or that don't
contain a return email address.
However, submitting a completely blank form results in me getting an email
with blank response fields.
Can you take a look at this code and tell me if it should be allowing blank
fields to be submitted? Are there any changes that can be made? Code:
I would like to make two field in a for required fields. Do you all know a simple way to accomplish this? I can post form and any asp if needed( page is getting really huge).
View Replies View RelatedI have a form field on an ASP page and was wondering if I can require the number that is entered to begin with a 0 or a 2.If the number starts with anything else,the user is notified to update the number correctly(Your [FormField] must begin with a 0 or a 2, Please update your entry).
View Replies View RelatedI need to do an email validation field. I found this on the net . Code:
if (/^w+([.-]?w+)*@w+([.-]?w+)*(.w{2,3})+$/.test(myForm.txtEmail.value)){
alert("Email valid")
return (true)
Can some explain what the words in underline means ?
Alright what I need to be able to do is to make the field it's maxlength if the user does not enter enough characters.
<input type="hidden" name="B" size="10" maxlength="6" value="">
so basicly if the user enters a 5, 4, 3, or 2 digit number the input will be forced to it's maxlength. I need this because I am writing to an SQL db and am combining multiple form inputs into one field in the db table ie(variable = A&B&C&D)
On a different webpage I need to display the variables. I am doing this by string manipulation functions like the one below.
Nbr = mid(aTable1Values(DATA, aRowLoop), 6, 6)
(DATA = A&B&C&D)
how to validate a DATE field i have written my own javscript method but it's not considering all apects so is there any readymade method to check date.
View Replies View RelatedI have a problem. Of course, or I wouldn't be posting here. Ok, now that Mr. Obvious is out of the way ...
I'm looking for some ideas. Take a look at the code below. I'm looking for the most efficient way to validate form field input on the server-side. I'll provide what I have. What I'm looking for are improvements.
<%
Function Validate_Input(Expression,Pattern)
Dim objRegExp
if Expression <> "" and Pattern <> "" then
Set objRegExp = New RegExp
select case (Pattern)
case "US_PHONE"
' sample matches: 1-(123)-123-1234 / 123 123 1234 / 1-800-ALPHNUM
' sample non-matches: 1.123.123.1234 / (123)-1234-123 / 123-1234
objRegExp.Pattern= "^([0-9]( |-)?)?((?[0-9]{3})?|[0-9]{3})( |-)?([0-9]{3}( |-)?[0-9]{4}|[a-zA-Z0-9]{7})$"
case "US_DATE"
' sample matches: 02/29/2084 / 01/31/2000 / 11/30/2000
' sample non-matches: 02/29/2083 / 11/31/2000 / 01/32/2000
objRegExp.Pattern= "(((0[13578]|10|12)([-./])(0[1-9]|[12][0-9]|3[01])([-./])(d{4}))|((0[469]|11)([-./])([0][1-9]|[12][0-9]|30)([-./])(d{4}))|((2)([-./])(0[1-9]|1[0-9]|2[0-8])([-./])(d{4}))|((2)(.|-|/)(29)([-./])([02468][048]00))|((2)([-./])(29)([-./])([13579][26]00))|((2)([-./])(29)([-./])([0-9][0-9][0][48]))|((2)([-./])(29)([-./])([0-9][0-9][2468][048]))|((2)([-./])(29)([-./])([0-9][0-9][13579][26])))"
case "EMAIL_ADDRESS"
' sample matches: asmith@mactec.com / foo12@foo.edu / bob.smith@foo.tv
' sample non-matches: joe / @foo.com / a@a
objRegExp.Pattern= "^([a-zA-Z0-9_-.47]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([a-zA-Z0-9-]+.)+))([a-zA-Z]{2,7}|[0-9]{1,3})(]?)$"
'The next line is supposed to be an RFC 2822 address compliant validation expression
'objRegExp.Pattern= "^(?:[w!#$\%&'*+-/=?^`{|}~]+.)*[w!#$\%&'*+-/=?^`{|}~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-](?!.)){0,61}[a-zA-Z0-9]?.)+[a-zA-Z0-9](?:[a-zA-Z0-9-](?!$)){0,61}[a-zA-Z0-9]?)|(?:[(?:(?:[01]?d{1,2}|2[0-4]d|25[0-5]).){3}(?:[01]?d{1,2}|2[0-4]d|25[0-5])]))$
case "ZIP"
' sample matches: 78754 / 78754-1234 / G3H 6A3
' sample non-matches: 78754-12aA / 7875A / g3h6a3
objRegExp.Pattern= "^(d{5}-d{4}|d{5})$|^([a-zA-Z]d[a-zA-Z] d[a-zA-Z]d)$"
case "CREDIT_CARD"
' sample matches: 6011-1111-1111-1111 / 5423-1111-1111-1111 / 341111111111111
' sample non-matches: 4111-111-111-111 / 3411-1111-1111-111 / Visa
objRegExp.Pattern= "^((4d{3})|(5[1-5]d{2})|(6011))-?d{4}-?d{4}-?d{4}|3[4,7]d{13}$"
case "NAME"
' sample matches: T.F. Johnson / John O'Neil / Mary-Kate Johnson
' sample non-matches: sam_johnson / Joe--Bob Jones / dfjsd0rd
objRegExp.Pattern= "^[a-zA-Z]+(([',.- ][a-zA-Z ])?[a-zA-Z]*)*$"
case "ADDRESS"
' sample matches: 2222 Mock St. / 1 A St. / 555-1212
' sample non-matches: [A Street] / (3 A St.) / {34 C Ave.}
objRegExp.Pattern= "^[a-zA-Z0-9s.-]+$"
case "CURRENCY"
' sample matches: $3,023,123.34 / 9,876,453 / 123456.78
' sample non-matches: 4,33,234.34 / $1.234 / abc
objRegExp.Pattern= "^$?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$"
case else
Response.Write("Invalid syntax used to call form validation function.")
Response.End
end select
Validate_Input = objRegExp.Test(Expression)
else
Response.Write("Invalid syntax used to call form validation function.")
Response.End
end if
End Function
' Get data from the form collection and assign to variables
dim str_Customer_Email
dim str_Customer_Phone
dim str_Customer_Name
dim str_Customer_Zip
str_Customer_Email= Request.Form("email")
str_Customer_Phone= Request.Form("phone")
str_Customer_Name= Request.Form("name")
str_Customer_Zip= Request.Form("zip")
if not (Validate_Input(str_Customer_Email,"EMAIL_ADDRESS")) then response.write ("error")
if not (Validate_Input(str_Customer_Phone,"US_PHONE")) then response.write ("error")
if not (Validate_Input(str_Customer_Name,"NAME")) then response.write ("error")
if not (Validate_Input(str_Customer_Zip,"ZIP")) then response.write ("error")
response.end
%>
Now, I'll obviously want to do more than write "error" to the screen with the validated input. What I *really* want ideas on is a more efficient way to validate the fields. In this small example doing them as one-offs isn't bad. On a form that has 20-30 fields it becomes cumbersome.
I need a text box to only take 6 digits. It should work like this:
If the user inserts say '89' form would actually send over '000089'. Likewise if they inserted 1234, again the form would send 001234, if they inserted 1 it would send 000001 and so on..
Yes, the easy way round this would be to give the users a message to input the data as 001234 for example, but is there any way this can be done dynamically?
I have a form that has both static and dynamic fields. I have no problem validating the static data, but whenever I try and apply form validation to a dynamic text box that has repeated rows, the validation does not seem to take. Do I have to run that validation through a loop? Code:
View Replies View RelatedI'm using ASP 3.0,IIS and Java script.I have created some text boxes Dynamically using java script.So the text boxes has got the same name. This is the code i'm using for that..
aTable1=document.all('myTableTBody1')
aRow1 = aTable1.insertRow(aTable1.rows.length);
aRow =aRow1
aCell = aRow.insertCell(0);
aCell.align = "Left";
aCell.width = "5%";
aCell.innerHTML = "<input type='text' name='Course' size='20'>";
Problem is that when i'm doing client side validation using javascript its not taking values..Here 2 or 3 or 4 text boxes with the course will be created when i use
this code:
if (document.Qualificationdetails.Course.value == "") {
window.alert ("Enter Course !");
document.Qualificationdetails.Course.focus();
return false;
}
it does not give any validation...
How i can get a text field that would accept apostrophes?
here's my code:
Title = Replace(Request.form("AddTitle")
Message = Replace(Request.form("AddMessage")
Author = request.Form("AddAuthor")
TimePosted = request.Form("AddTimePosted")
DatePosted = request.Form("AddDatePosted")
sql="INSERT into NEWS (title, message, author, date_posted, time_posted) "
sql = sql & "VALUES ('" & Title & "', '" & Message & "', '" & Author & "', '" & DatePosted & "', '" & TimePosted & "') "
Conn.execute(sql)
Response.write sql
i am using ASP with recordset I am using nvarchar field and TEXT field in ms sql server
i update it as follows
rs("thenvarcharfield") = request.form("somedata")
rs("thetextfield") = request.form("someotherdata")
rs.Update
at one page it works fine and when i use the same kind of code to update another TEXT field it doesn't update and the I.E. loading bar increases very slowly and the next page never loads someone suggested to use .appendchunk i used rs.appendchunk and i got the error "object doesn't support this property or method" he also said that .appendchunk cannot be used to update nvarchar.
i removed the code to update TEXT field and the page loaded as expected (normally)!
Why one text field worked fine while the other didn't?
I want to create two radio button
Yes and No. Only on select that radio button 'Yes',
the text field should get enabled.
How to do this?
i have a table in which i have many text boxes, they are named as a1,a2,a3,a4 to a16 the next row is b1,b2,b3 to b16 and so on up to G1,G2 etc, where the user enters his data, what i want to do is only allow the user to enter numbers, which can have decimals if required,
how can this be done, also i have another set of textboxes through which i want to loop and prevent user the user from entering the same data in more then one box how can this be done any help will be appreciated thank you.these are the text boxes a1,b1,c1,d1,e1 etc which is actually the first column in the table.
i have created the following array:
letterArray[0] = 'A'
letterArray[1] = 'B'
letterArray[2] = 'C'
letterArray[3] = 'D'
letterArray[4] = 'E'
letterArray[5] = 'F'
letterArray[6] = 'G'
how can i loop through to achive the above.
May I know how to restrict the user to key in at least 6 characters from the text field by using asp? If possible
View Replies View RelatedI am trying to write some code that inserts or updates a text field in my SQL Server 2000 database. The SQL statement is created using a submit from a form, and the text is coming from a <textarea>, and therefore being placed into the SQL statement via a Request("field"). However, due to limitations in SQL Server 2000 and text fields, I can not use a simple Update or Insert command with text over 8000 bytes.
Does anybody have any sample statements that will help me update that field with larger amounts of data? I have tried using the WRITETEXT function and UPDATETEXT function with little or no success.
i have a form that has two hidden fields.The first hidden field will has a value like this 'EM12HILL.JPG'.The second hidden field has a value like this 'AA01'.What i would like to happen is when submit button is pressed, the characters in the first hidden field will change to the following 'AA01HILL.JPG', as they are passed to another form.
View Replies View RelatedHow do I clear the data in this field before using the date function.?
<input type="text" size=35 name="DepartCentralDate" value="<%=x_DepartCentral %><%= FormatDateTime(Date, 1) %> <%= FormatDateTime(Now, 3)%>">
Is it possible to recall a variable with the combination of text + rs.field? i want to recall the variable "speler1", at the place weher rs("speler") is 1. It's probably again easy.
View Replies View RelatedI been searching google but I can't find how to shorten a text field and if it has been shortened to place a space and triple dot (...) after it. So if the text field was 75 characters long it would shorten it to 50 and add " ...". Is it also possible to shorten it to 50 to the nearest word? This is what I got so far: Code:
...
<td>
<p>
<% = left(rs("my_text").value,50) & IF rs("my_text").count > 50 Then Response.Write(" ...") End If %>
</p>
</td>
...
In a form I have one pulldown menu, and one text field. Both MUST get their values from an Access database they connect to. Without submitting the form, how do I change the value appearing in the text field by changing the selection in the pulldown menu? Remember both the text field and the pulldown menu MUST get their values from a database.
View Replies View RelatedI need a user to follow a format. For example entering a date. I need the user to enter a date in this format MM/DD/YY. How do I check to see if they followed that format?
I need the user to enter a currency amount without the "$" sign. How do I check to see if the Request.Form("price") value has a "$" sign in it? I guess I need to know how to parse a string in ASP.
Is it possible to make the following codes Value = idSpecies but its Label TimberSpecies?
<input name="f1" type="text" id="f13" value="<%=((rsResults.Fields.Item("idSpecies").Value))%>" size="33">
I have a database with the following...
Table Name.....Query1
Field Name......idSpecies..........Auto Number
Field Name......TimberSpecies...Text Field
I have an asp page that allows cdont mailing of form field values to persons matching slected criterea in their profile.
Works good if the user goes straight from the form to the email-making asp.
Then the user asked for a proofreading screen and what seemed simple took a bad turn.
When I try to pass from the proof reading screen to the asp that actually sends the email I only get the first word. as soon as a blank is encountered in the text it thinks it it done. Code:
i have a formular using two text field. i want , when i finish writnig , moving to the next using " Enter " key.
View Replies View Relatedhow to lock down a text field so that data displayed within it cannot be altered?
View Replies View RelatedI want to search text field and highlight the text. This is the code,
Code:
strText = cstr(Request.form("strText"))
strText = uCase(strText)
strTextWhere = ""
strTextWhere = " and (Specialisation
like '%"&strText&"%') "
I have a lot of data in different cases. I can do the search, let say i want to search by keyword project, it will display all the "project", "Project" and "PROJECT". But now i can only hightlight the "PROJECT" only. I think this is because of ucase(strText). Is there any way for me to highlight all (either lower, upper and mixed cases)?
Is there any way I can pass the value in a disabled text field without creating a hidden field?
View Replies View RelatedI need to make a text field equal to the entered value. Example: First time to the page nothing will show up in the field because nothing was entered. I enter a value and submit the form. The redirect is to the same page to add new inforation but this time the value entered in that one text field will be there. I tried <%=Request.Form("box")%as the value of the text field but to
no success.