Checking Form Values
Is there an easy way in ASP to check the value of a form element, like a hidden field, of the current page, not the previous page?
View RepliesIs there an easy way in ASP to check the value of a form element, like a hidden field, of the current page, not the previous page?
View Repliesi have a null value in one of my session variables.
So i tried using this:
if Session.Contents("Department") = "" then
response.write "DEPARTMENT IS NULL"
end if
it doesn't work though.
Session.Contents("Daepartment") = null doesn't work too.
how should i do the checking to check for null values?
I am using a ASP.NET function that returns a table with columns and rows and data (in the cells) taken from my DB (using ado.NET). That function actually returns a set of HTML tags with values, Labels and input boxes. All of that is working fine but now (after the function build that form whith that table) I want the user to fill some of the input boxes located in the last column.
The problem is that i do not know how many input text boxes had been changed by the user (different rows) and i need to manage all the input data of those input boxes.
in VB.NET I can use a loop which goes for each and rvery control and take its text (or value) property.
How can I do that here ?
How can i chack each of the input boxes values using a loop (becuse that input boxes had been filled accourding to a database and in additional the user changed/Add values to some of them ?
for information, to fill the that table i am using a loop that filled the table rows and values accourding to the rows in the DataBase and names of those inputboxes called: "Amount_" & i the "i" is an index which represent the row in the database.
I'm using a radio button in a form and I'm requesting it in the processing page. The name of the radio button is box and I want to say something like..
if box (the value I gave the request.form("box") = checked then
boxval="1"
what's the correct term for checked? Because that's the part not working.
I want to call a recordset so you can edit the details and then obviously pass the parameters onwards into the db. However, the user guide just says this:
To process other fields in the form, use the Form collection of the upload object the same way you would use the Form collection of the Request object. For example, if your form had a text element named UserName, your processing code would include: Code:
The script is designed as a form validator which checks fields for various criteria and then sends a mail with the form contents. Since 40 different forms will be plugged into this script, there needed to be complete seperation between the two.
I've managed it so far by checking for required fields by putting the word 'required' into the name of the field. The script then sources out any fields which has this text and checks them to see if they are filled out.
The problem I've come across now is that I need to check for field length. My idea was to put the amount of characters needed into the name of the field in the form and then have the script check with a Reg Exp. However, Im not too sure of the regular expression needed to check for this.
Can someone suggest one? The one I have at the moment is [1-14] but say I had a field like this: <input type="text" name="passwordrequired12"> That would match bout for 1 and 12. Any ideas?
I have a form field that will contain an IP based on a TeamSpeak or Ventrilo IP. What I need to do, is check to make sure there are 4 groups of numbers in the form field. Or, check to see if the entry contains 3 periods. 1.2.3.4 <--- example there are 4 groups, and 3 periods.
Now of course, the IP can be as large as 4 groups of 3 numbers, so I can't check string length. how would I check this and validate it on my asp processing page?
I need to check a form to make sure the ID is between 8-15 characters and the password is between 8-10. I can create the form, but am not sure how I could check these lengths. i'm sure there is some simple code and also I do not know where I would put it.
View Replies View RelatedI have a form that currently input data into an access db. The first thing that I would like to happen when the Submit button is clicked, is to check one column in the database to see if there are any duplicates before uploading any data. So my question is, how?
View Replies View Relatedi'm making a forum, and previously i was submitting the form to an asp file, which would check for errors -- if there were errors, it would redirect back to the form with error messages to be displayed -- if it was error free, the message would be written to a txt file.
but then i wanted to put in a preview message page, and so error checking and passing values between the three pages is becoming tricky. so i'm at the point where i'm starting to use javascript to error-check, which works fine for making sure the input is good, but i don't know a good way to notify the user that there are errors with javascript. alert messages are unprofessional, and i can't just add text to the page using javascript.
i'd prefer to use only asp, and i'd prefer it if i didn't have to use an extra asp page JUST to error-check. as it is now i have these pages involved in adding a new subject:
post subject (has the form for the subject and message; the user can click either post message, which will directly write the message, or preview message, which will bring them to a page which displays the post as it would appear once written)
preview message (regardless of what the user clicks, it would come here first to do error checking, and depending on what the user clicked it would either redirect to the page which writes the subject, or display the message;
the problem is, if there are errors with the form, i need to point the user back to post subject without losing whatever info they have already entered. the only way i know how to do that is by submitting a form [i can't use a querystring because it won't maintain the message if the user entered multiple lines in the message])
add subject (this does the backend writing of the message, and is only accessed if the fields have made it through the error-checking)
any solutions in mind on how to pass the field values between these three pages?? or is there a better way i can do error checking??
How do I check the field for example zip code to make sure that it has 5 digits?
View Replies View RelatedI'm trying to verify a request.form("blah") with a field (value) in a recordset taken from an Access Database. Basically what I'm trying to do is once this NUMBER is entered into the form object (textfield), check a database to see if this number has been used (i.e. in the database) and if so redirect them to an error page.
I thought this would be rtight, but doesn't seem to work
If rsTeddyCheck = Request.Form("PersonalID") then
response.redirect ("Error.asp")
Else
process.asp
End If
how to create a form that would handle basic error checking within the ASP itself?
View Replies View RelatedHow do you check for a empty value from a form?
lservice = request.form("pservice")
if not isnull(lservice) then <== this doesnt work.
tried "" empty string and it still didnt work.
......
I'm having problems with the fact the user didnt enter anything. The field is optional.
i have a form for users to enter their name password and e-mail,i am currently using javascript to check that all details have been filled,
if(myForm.fname.value=='')
{
alert("Plz enter a first name")
return false
}
This works if the field is left blank however if the user enters numbers(1,2) or spaces i.e.(" ") how do i deal with these,i also need to check that the e-mail contains "@" and "."
I have a form that is dynamically generated since it is populated with values retrieved from a database. The form can of course also be submitted, which is where I run into some problems.
Since I never know in advance what the length of the form (or for that matter what the different elements' names and values) will be I don't know how to write the code in "receive.asp" to retrieve all values from the form correctly without excess use of "request.....".
I shouldn't have to write requests for every single potential element name that is stored in the DB. Please note that the form can sometimes also contain radio buttons and check boxes, even though they are not present in this short example Code:
I have a form on an ASP page that has 5 text boxes, for data entry. I am trying to get data from the text box, and pass it to a hidden text box on the form.
The hidden text box is called "MyDateTime" (a SQL date and time value). I am attempting to concatenate data from two other textboxes (one for date and one for time) to give a string like : "8/8/2004 8:00 AM" I am trying to use the following: Code:
<%@Language=VBScript %>
<%option explicit%>
<%
MESSAGE = (Request.Form("type"))
MESSAGE=MESSAGE & vbcrlf & "Name" & (Request.Form("name"))
MESSAGE=MESSAGE & vbcrlf & (Request.Form("address"))
MESSAGE=MESSAGE & vbcrlf & (Request.Form("handphone"))
MESSAGE=MESSAGE & vbcrlf & (Request.Form("phonenumber"))
MESSAGE=MESSAGE & vbcrlf & vbcrlf & (Request.Form("comments"))
MESSAGE=MESSAGE & vbcrlf & vbcrlf
MESSAGE=MESSAGE & "____________________________________________"
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From =Request.Form(email)
objMail.To = "icepricessa@hotmail.com"
objMail.Subject = "Business/Career Enquiries"
objMail.Body = ""&MESSAGE&""
objMail.Send
Set objMail = Nothing
%>
but somehow i'm not able to send the mail....
I have the following line of code in my asp page:
Dim ix
For ix = 1 to Request.Form.Count
fieldName = Request.Form.Key(ix)
fieldValue = Request.Form.Item(ix)
Response.Write fieldName
Response.Write fieldValue &
Next
Response.End
It is not returning the results of any field on the previous form page.
Does anyone know what I might look for?
How can I getting parameter values from more than 1 HTML form onto the same ASP page?
View Replies View Relatedput the ASP part where Page 3-Displaying form values from one page on another
View Replies View Relatedwe have a web system whena user submits a form, it's take to a page... if the user didn't fill in a particular form properly then resulting page tells them so. they then go back and fill in the remaining fields.this works for all but 1 user whose values disppear totally, having to do it all again.has he got his computer set up differently?
View Replies View RelatedI have created a asp page "AddUsers.asp" which allows the admin to create new user ids.The admin fills in all relevant details and clicks on submit.The form gets posted to a page "Insertusers.asp" which checks if the new entered userid already exists in a database.
If the userid already exists, page display a message saying "Userid already exists" and a back button(link to Addusers.asp).When the admin clicks on back button, it takes him to Addusers.asp and all the relevant details entered in a form are lost.Again he has to fill in all the details which i want to avoid.How can i retain the values entered in the form so that the admin can change only the userid and submit the form again?
I have a problem where form values go missing. The are several forms on one page with indivdual names (i.e. form1, form2) but with the same fields. Whenever the form is submitted via post the values disappear. It only happens on this one particular page.
The odd thing is that if I do a response.write with the variable and then a response.end write after it it shows up perfectly. The page is just a basic record update page. If I do a response.flush() it works as well (up until the redirect). I am leaning towards a response buffer problem but still don't understand why it is happening.
I came up with the new problem. I want to fetch all form values by using request.form("FormName") which is generated by javascript on runtime.
The attached zip code contains the working code of javascript creating dynamic form elements. So after generating a couple of textboxes when I click on the "Submit" button it should display all the values entered in the textboxes on the next page.
I am trying to create a page that displays the values the user has just selected from my form. The form consists of three drop down lists. Upon clicking the submit button, I would like to go to a new page that says something along these lines:
"Thank you for filling out the form. You have successfully transfered account _____ (value from one drop down) from ______ (another value) to ________ (the last value)." How would i go about doing something like this?
Does anyone have the code to write all the form values to variables of the same name. So for example request.form("myname") would be stored in a variable called myname after running this. It should just save time from doing the request for all the fields.
View Replies View RelatedIs it possible to save all the names/values of a form to another memo textfield before a Insert to the database then when required on another page split that memo textfield into the name and their corresponding values retrieved from the recordset ?
View Replies View RelatedIf I have say 10 fixed variables, how can I set their values = to that of a form that is built dynamically?
column1column2
email=formvalue(0)
fname=formvalue(1)
lname=formvalue(2)
etc..
lastvar=formvalue(9)
Is there a way to store a form value that can be passed across multiple
pages, other than creating a session variable for the form value?
Can an array be created to hold form values and maintained and used across
many pages? Or, other alternatives?
I've used session variables, but have understood that using many session
variables isn't good and there would be a better method to handle this?
I have created a form. I have a log in page and a view registration page. When a user logs in I have to display only their information on the registration page. But when an admin logs in...
they can view all the records in the database. I am not sure how to do this. Can anyone help me? I have included that code that I have now. Right now...when the users log in they see everythings. Code:
I have a form F1, once submitted it goes into another form F2, I want the fields in F2 to be filled with the values the user filled out in F1. in php I would use the $_POST[] to get it, but I dont know nothing of asp
and from what I could find on the web, would this work?
Code:
<asp:textbox id="txtLastName" runat="server" MaxLength="30" Width="140px" Height="21px" value="Request.Form('lname')">
and what if they accessed the page directly, rather than through a previous form, would it field appear blank? or do I have to have an if statement. also what if based on the F1 value I want to select (check) a checkbox/radiobutton or drop down menu in F2?
I am trying to total the value of some form fields I am referecing the form
field with an inner loop, I am having a little trouble because the amount of
fields returned is always different, how can I roll-up the total of the form
fields (request.form("subtotal_"& i)) to get one final figure? Code: