Form Field Length Validation
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)
View Replies
ADVERTISEMENT
We 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:
View Replies
View Related
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 Related
I 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 Related
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 Related
I 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.
View Replies
View Related
I need asp code for validations that needs to check if the value of the querystring variable received was alphanumeric and length of 7 characters. This querystring will be passed from another site so I am not doing client side javascript validations . If the length of the querystring variable is more or less than 7 then a user friendly error message be displayed.
View Replies
View Related
I'm working with a file upload form and want to evaluate the length of the filename and if it's greater than 12, cut it off as such:Code:
StrFileName = Form("SourceFile").FileName <--show the whole name if its less than 12, or
StrFileName = LEFT(Form("SourceFile").FileName ,10) & "..." <--cut it off after 10.
I don't know how to evaluate the form input length and do the if then's based on it, though.
View Replies
View Related
In my database table , I have field to store the text, I am tryinf to find the length of the filed in ASP like below
response.write len(rs("cname1"))
It is displaying the value , when the data in the field is nonzero, it is not displaying anything if the filed is mty in table. I cant understand y it is displaying the length as 0 , bcaz i want to compare the length , if the length is zero , it will display one result or else it will display the value.
View Replies
View Related
Access Database
Field required = no
for i = 0 to 2
arrParap(i) = MakeSafe(Request.Form("ppara_text"&cstr(i+1)),2400)
arrImgp(i) = MakeSafe(Request.Form("pimage"&cstr(i+1)),50)
arrImgpPos(i) = MakeSafe(Request.Form("pimgpos"&cstr(i+1)),50)
if len(arrParap(i)) > 0 then
strQp1 = "INSERT INTO paragraphs(para_page, paratext, paraimage, imgposition)"
strQp1 = strQp1 & "VALUES ('" & objRS1("Subcateg_id") & "', '" _
& arrParap(i) & "', '" _
& arrImgp(i) & "', '" _
& arrImgpPos(i) & "')"
objConn.Execute strQp1
End If
result
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Field 'paragraphs.paraimage' cannot be a zero-length string. /content-builder/admin/pageadd.asp, line 53
View Replies
View Related
Three text fields on a PDF doc. These fields are limited - only 15 lines each.
Strings are separated by breaks and if a string is too long, it wraps to a new line, decreasing the number of items that can go into the field.
So, a for loop from 0 to 14 works only if a string in the array is not too long.
Then, and if and another for from 15 to Ubound -1
Another if and another for. Code:
View Replies
View Related
I have one field char type data length 1.. It has data either 1 or 2 in all the field tht I have checked through enterprise manager.
I'm running query:
"select * from table" and fetching all the records and displaying...
It display all the data except data from this field..Doesnt display anything..
I had put Response.write rs("fieldname")
What could be the problem?
View Replies
View Related
Scenario: I have an ASP form that serves to the browser, anything from 1 to 20 rows of textboxes. How I've implemented this is that the user specifies in th previous page how many rows he intends to add, and then the form uses that value in a FOR...NEXT loop to serve the HTML that creates those textboxes. Each textbox is given a unique name based on the current iteration of the FOR loop.
Now, where i've had a prob is that on the submission of this "variable-row" form, I'd like for ASP to be able to tell me how many rows the user entered. I tried using request.form.length already, but no luck there (ASP says it's not supported).
View Replies
View Related
I am trying to pass a hidden field value on a form into another field on the
form so that it can then be inserted in the database, to enable me then to
reference that number at a later date.
(The hidden value (1 for example) would then automatically get passed to the
other input field.)
The code for the text field that allows users to type an number into it for
submission to the db is below, but what code do i need within the hidden
field to populate this text field below so that users do not have to type the
number in? Code:
View Replies
View Related
I'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 Related
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 Replies
View Related
I 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 ?
View Replies
View Related
I'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 Related
i 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 Related
In my prototype asp page (with no javascript and no password validation, I have a registration form with the following action:
<form name="form" method="post" action="RegDetails.asp">
This works fine, the form details are collected by RegDetails.asp
I am attempting to include javascript server side validation for the pasword, which obviously requires password and password2 fields (to be verified). I have used the script available at:
http://javascript.internet.com/forms/val-pass.html
It works fine in a new blank page with the form action:
<form name=myForm onSubmit="return validatePwd()">
The final stage in this javascript demo form displays an alert box:
else {
alert('Nice job.');
return true;
When I change the first line of my original form to:
<form name=myForm onSubmit="return validatePwd()">
how do I get my original action of - action="RegDetails.asp" instead of this alert box?
View Replies
View Related
I have a simple form to accept two form fields and display the values
entered on pressing the submit button. The following is the form I have
created to accept the two entries and display the form fields on
pressing the submit form. It does not work can somebody please correct
the code or provide a simple equivalent code where I can have the form
and the validation and usage of the form values in the same ASP page.
Code:
View Replies
View Related
can any one show me how to validate the serial number in numerical format like this:06-02-01-xxxxxx
the code i try to use was as below but cannot be done:
If IsNumeric(Form_serial_no)=0 OR InStr(Form_serial_no,"-")=0 Then
Response.write "<br>*Serial Number in wrong format"
Validated_Form =False
End If
View Replies
View Related
how can I validate the form; like making sure the user has entered there phone number in (###)-###-#### this format or social secruity ###-##-####. How could I make my form pop an alert box up when they click the submit button so they will not be able to submit till they follow the following format.
View Replies
View Related
On contact, order, recommend a friend page etc. I run a JavaScript that checks that all the required information has been entered into the form, and it will stop the ASP script executing until you change the incorrect information and Submit the form again. With this script, there is a function that checks the email address and tells you if the address is not valid. (i.e. If the address doesn't have an @ sign).
I put this script to work, and found that many people were turning off JavaScript, filling the form in (and now obviously enter XXXXX) into the email address field and then sending the form that way.
As a safety net, the ASP application that sends me an email checks that fields are not blank, but I don't know how (or whether) you can check to see if the email address is valid.
View Replies
View Related
I need to create a self-validating HTML form using a server-side Excel spreadsheet as the datasource. The customer punches in their order number into the form. A lookup occurs. The rest of the form fields populate automatically with relevant data from the spreadsheet.
View Replies
View Related
I have a form that is created dynamically from a recordset, this creates a line for each record together with 2 checkboxes, Yes & No so the source output would be something like this:
<p>Please indicate whether you still use each piece of software detailed below:</p>
<form name="apps" method="POST" action="MyAction.asp">
<table width="600" border="1" cellspacing="0" cellpadding="5">
<tr bgcolor="#9999FF">
<td><font color="#FFFFFF"><strong> Software</strong></font></td>
<td><font color="#FFFFFF"><strong>Required?</strong></font></td>
</tr>
<tr>
<td>Adobe Photoshop 7.0 7.0</td>
<td><input type="checkbox" name="Yes" value="Adobe Photoshop 7.0 7.0">
Yes
<input type="checkbox" name="No" value="Adobe Photoshop 7.0 7.0">
No </td>
</tr>
<tr>
<td>Citrix ICA Client</td>
<td><input type="checkbox" name="Yes" value="Citrix ICA Client">
Yes
<input type="checkbox" name="No" value="Citrix ICA Client">
No </td>
</tr>
<tr>
<td>Macromedia Dreamweaver MX 6.0</td>
<td><input type="checkbox" name="Yes" value="Macromedia Dreamweaver MX
6.0">
Yes
<input type="checkbox" name="No" value="Macromedia Dreamweaver MX
6.0">
No </td>
</tr>
</table>
<p>
<input type="submit" name="Submit" value="Submit">
</form>
And so on......
I want to ensure that either Yes or No has been checked for each line before the form can be submitted, can this be done in asp? The amount of lines in the form will vary.
View Replies
View Related
i have a radio button and i want to pass the value of the radio button which it holds to a javascript and then pop up a message box with that value Code:
View Replies
View Related
I am working on a script in asp (new to asp, 99% php) and I would like to validate the data (no problem) and then repopulate the data in the table that passed validation, spit out error message for bad data, and leave those areas blank, without using javascript.
I had no problem doing this in the past with php (they have more and better array methods in my opinion) but I am struggling with how to do this in asp.
Has someone done this before? If so, could you share the logic on this?
Scenerio: two fields, one validates, one doesn't, show the form with first name given and last name blank while displaying reason for last name error. I understand the scenrio, but I can't make it work in asp???
View Replies
View Related
Let's take this for example:
<form action="" method="post">
Firstname: <input name=""frmFirstname"><BR>
Lastname:" <input name=""frmLastname"><BR>
Email" Address: <input name=""frmEmailAddress">
<input" type="submit">
</form>
what i want to do is to show a Javascript Alert Window when the user enters a blank field and when the user enters an invalid email format.
View Replies
View Related
I'm making form validation that checks a form that will be added to the database when filled out correctly, the error message will be in the form of a line above the form stating that you forgot to enter some fields correctly and pictures of X's behind the field that weren't Filled out correctly. But I can't get it to work correctly. Can someone please help me and if possible change my code or tell me where exactly I need to add certain pieces of code.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/conn_db.asp" -->
<%
Function isValidation(Len)
If Len(Request.Form) > 0 Then
name = Trim(Request.Form("name"))
formOk = True
If name = "" Then
errName = "*Error: Please enter your name"
formOK = False
End If....
View Replies
View Related
I am trying to validate an asp form with VBScript, I am searching on the net but can't find the proper way to validate an option button to ensure one of the options was selected. Here is my code This one validated whether you select an option or not: Code:
View Replies
View Related
First off wanted to that all that replied to my previous questions, you were much help.Had a couple of general questions.Why has everyone suggested not using VB Script on the Client Side?
Secondly, I have decided to do my validation on the processing page.If a field on the form does not meet the validation rules, I am able to redirect back to the sending page. How do I do this so that the sending page retains the values that the Client had previously put in so that he only needs to correct the fields that are not valid?
View Replies
View Related
have 6 checkboxes on the form i want the user to select 3 of them if the user doesnt select any of them fire an alert if the user selects 3 of them then only submit the form if the user selects 5 of them fire an alert telling him he has to select only 3 same thing applies if he selects 2 checkboxes tell him to select 3
here is the code i have written and its not working ...
View Replies
View Related