473,320 Members | 1,979 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,320 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 4803
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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.