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
acoder
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
Markus
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
acoder
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
TheServant
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
ziycon
384 256MB
@TheServant
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
TheServant
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

2
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? -...
2
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...
10
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...
3
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...
2
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...
3
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...
3
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...
1
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...
8
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. ...
0
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...
0
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...
3
isladogs
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...
0
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...
2
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...
0
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...
0
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...
1
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...
0
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.