473,226 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,226 software developers and data experts.

Form Select Default

384 256MB
I have a form with three fields for date of birth, day/month/year. When a user selects their dob, if not all details on the form are correct then the form is reloaded with any data entered already still there for the user, the problem i have is keeping the dob selected in the select fields, say a user select 21/04/1988 the three dob selects would default to dd/mm/yyyy which are the three default values, i need it to stay on the user selected date the user entered!??
Feb 15 '09 #1
6 4801
16,027 Expert Mod 8TB
Set the options as selected, e.g.
Expand|Select|Wrap|Line Numbers
  1. <option value="24" selected="selected">24</option>
Feb 17 '09 #2
6,050 Expert 4TB
Of course, HTML won't be able to tell you which option was previously selected; you'll need javascript (or something else) for that.
Feb 17 '09 #3
16,027 Expert Mod 8TB
I assumed that form reload meant a page reload, so you'd use server-side code to determine which option should be selected.
Feb 17 '09 #4
1,168 Expert 1GB
Can I suggest using javascript to validate the form before it is submitted to the server to process. Not only does this save on server load, but it also is a quicker response for the user.
Basically you write some javascript code which checks that all the values entered are valid before it sends it to be processed. This is not 100% because a small percentage of users have javascript disabled, but it should work for most of your visitors... The worth while ones atleast :P
Google "Validate forms javascript" or something like that to get some sample codes.
Feb 18 '09 #5
384 256MB
I've done all the validation through the PHP script as not everyone will have javascript enabled!

Go the 'selected' thing working, thanks!
Feb 18 '09 #6
1,168 Expert 1GB
It is a good idea to have both javascript validation as well as PHP validation. It reduces the number of requests and saves the user time as I mentioned. Anyway, glad to hear it's working.
Feb 18 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

by: jason | last post by:
Is it possible to POST a FORM to multiple URLS at the same time....OR.... Is the only workaround for this scenario to use response.redirect in the called ASP page and do a multi processing? -...
by: Mark Watkins | last post by:
suppose I have the following: -----------BEGIN page1.asp---------- <form method="post" action="page2.asp"> <select name="someData" size="1" class="smallbutton"> <option...
by: Doug O'Leary | last post by:
Hey, all. I have a perl script which generates the html listed below. I cleaned it up a bit since the perl CGI module creates some really ugly html code. I've looked at this thing 8 ways to...
by: Steve | last post by:
Form FrmRestock's recordsource is QryFrmRestock. The TransactionDate field's criteria is set ats: Forms!FrmRestock!LastXDays. LastXDays on the form is a combobox where the selections are 30, 60...
by: Almir | last post by:
I have a simple problem, i just can get a grasp on it. I designed a database for inventory of computer equipment. Now i created forms for each table. Each piece of equipment is going to come in an...
by: Earthling | last post by:
Any help would be appreciated to solve the following simple problem that I will describe. *** There is a form called "red chocolate form". The form has a particular subform field that has a...
by: Bill | last post by:
I'm using the POST method to submit a simple form html page with yes/no and checkbox fields to an asp response page which stores the values in a new dim string, then uses it to build a new table...
by: Rick Owen | last post by:
Greetings, I have a form that, when submitted, calls a plsql procedure. The form has a number of fields (text, hidden, select, radio) but the particular field that is giving me problems is a...
by: chromis | last post by:
Hi, I'm writing a contacts section for a cms on a website, I've decided to write the section in OO code. So far I have my Contacts object and a page structure I would use for a procedural site. ...
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.