473,809 Members | 2,849 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

month and day of month edit fields


I wish to have a month select and next to it a day select.

Is there no way at all for the day field to pick up the selected month
without a previous submit on the part of the user?
Feb 19 '07 #1
8 1675
Hi Richard

Richard wrote:
I wish to have a month select and next to it a day select.
Is there no way at all for the day field to pick up the selected month
without a previous submit on the part of the user?
Client side programming languages i.e. JavaScript (AJAX)...

HTH; Johannes
Feb 19 '07 #2
On 19 Feb, 12:45, Richard <rgr...@gmail.c omwrote:
I wish to have a month select and next to it a day select.

Is there no way at all for the day field to pick up the selected month
without a previous submit on the part of the user?
What a negative way of asking!

How about "Is there any way that..."

Anyway, it depends on what you mean by "a previous submit".

3 ways spring to mind of how to do this:

1) Use pure local javascript to populate the day select based on the
selected month. No submit required at all.
2) Use an AJAX type call to let php/javascript populate the day
select.
3) Have the month select automagically submit the form and have it
return a populated day select control.

Of course, you could just use a javascript pop-up calendar.

Feb 19 '07 #3
"Johannes Vogel" <ne********@jvo gel.chwrote in message
news:89******** *************** ***@news.hispee d.ch...
Hi Richard

Richard wrote:
>I wish to have a month select and next to it a day select.
Is there no way at all for the day field to pick up the selected month
without a previous submit on the part of the user?

Client side programming languages i.e. JavaScript (AJAX)...

Fuck Ajax. There's no need to get all ajaxy and "hey look at me I'm so
web2.0" for something as trivial as testing wether february has 28 or 29
days. All other months are constants, they have either 31 or 30 days, then
you just populate the day select with given number of days. What the hell
would you do with ajax?

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
sp**@outolempi. net | rot13(xv***@bhg byrzcv.arg)
Feb 20 '07 #4
Rik
Kimmo Laine <sp**@outolempi .netwrote:
"Johannes Vogel" <ne********@jvo gel.chwrote:
>Richard wrote:
>>I wish to have a month select and next to it a day select.
Is there no way at all for the day field to pick up the selected month
without a previous submit on the part of the user?

Client side programming languages i.e. JavaScript (AJAX)...

Fuck Ajax. There's no need to get all ajaxy and "hey look at me I'm so
web2.0" for something as trivial as testing wether february has 28 or 29
days. All other months are constants, they have either 31 or 30 days,
then
you just populate the day select with given number of days. What the hell
would you do with ajax?

Well, if you want to limit the choices in the day after selecting the
month, without a submit in between, certainly some client side code is in
order. However, most people are smart enough to select real dates, and if
someone was to select for instance 31/04, my code usually just assumes
they mean 01/05.
--
Rik Wasmus
Feb 20 '07 #5
Hi Kimmo

Kimmo Laine wrote:
"Johannes Vogel" <ne********@jvo gel.chwrote in message
news:89******** *************** ***@news.hispee d.ch...
>Richard wrote:
>>I wish to have a month select and next to it a day select.
Is there no way at all for the day field to pick up the selected month
without a previous submit on the part of the user?
Client side programming languages i.e. JavaScript (AJAX)...
Fuck Ajax. There's no need to get all ajaxy and "hey look at me I'm so
web2.0" for something as trivial as testing wether february has 28 or 29
days. All other months are constants, they have either 31 or 30 days, then
you just populate the day select with given number of days. What the hell
would you do with ajax?
That's because I wrote i.e. JavaScript. But it's possible with AJAX
mechanism too.

It's not as trivial as you wrote for testing how many days a month has -
and you have to check the date again after sending to the server.
Perhaps with AJAX it's smarter to program.

HTH; Johannes
Feb 20 '07 #6
Captain Paralytic wrote:
1) Use pure local javascript to populate the day select based on the
selected month. No submit required at all.
Better still, initially provide a day select with 31 days, and then
*depopulate* it based on the selected month. That way:

- it's still very usable for non-JS users;
- people can select the day first, then the month, if they wish.
2) Use an AJAX type call to let php/javascript populate the day
select.
As Kimmo said, AJAX is overkill here. Using AJAX, you add an extra
round-trip to the server, break your form in non-AJAX-capable browsers,
all for no real benefit. It's trivially easy to calculate the number of
days in any given month using client-side Javascript. No advantage
whatsoever in having the server do it for you.

(Of course, you will still need to do sanity checks on the server! One
must always do so!)

An alternative would be something like:

<select>
<option>01 Jan
<option>02 Jan
<option>03 Jan
...
<option>30 Dec
<option>31 Dec
</select>

though that adds about 5 kB of data to the page.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Feb 20 '07 #7
On 20 Feb, 14:15, Toby A Inkster <usenet200...@t obyinkster.co.u k>
wrote:
Captain Paralytic wrote:
1) Use pure local javascript to populate the day select based on the
selected month. No submit required at all.

Better still, initially provide a day select with 31 days, and then
*depopulate* it based on the selected month. That way:

- it's still very usable for non-JS users;
- people can select the day first, then the month, if they wish.
2) Use an AJAX type call to let php/javascript populate the day
select.

As Kimmo said, AJAX is overkill here. Using AJAX, you add an extra
round-trip to the server, break your form in non-AJAX-capable browsers,
all for no real benefit. It's trivially easy to calculate the number of
days in any given month using client-side Javascript. No advantage
whatsoever in having the server do it for you.
I completely agree with this sentiment.
Remember that my preceeding statement was:
Anyway, it depends on what you mean by "a previous submit".

I would either use javascript to populate the list or a popup
calendar.
However, since the user had mentioned a submit, he may have had a
reason for going to the host, so I offered all the obvious options.
>
(Of course, you will still need to do sanity checks on the server! One
must always do so!)

An alternative would be something like:

<select>
<option>01 Jan
<option>02 Jan
<option>03 Jan
...
<option>30 Dec
<option>31 Dec
</select>

though that adds about 5 kB of data to the page.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!

Feb 20 '07 #8
..oO(Johannes Vogel)
>It's not as trivial as you wrote for testing how many days a month has -
All it needs is a test for leap years, which is a very simple algorithm.
>and you have to check the date again after sending to the server.
You _always_ have to check _everything_ on the server. Client-side
validation can be nice to have, but it's completely unreliable.
>Perhaps with AJAX it's smarter to program.
Not in this case. It would require an additional but useless HTTP
request and you still have to validate again on the server.

Micha
Feb 20 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
9634
by: johkar | last post by:
I need to document.write out a select list populated with the dates for the first and third Wednesday of each month. How do I get to the actual days? <select name="mySelect"> <option value="Oct 1, 2003">Oct 1, 2003</option> <option value="Oct 15, 2003">Oct 15, 2003</option> .....and so on for a continual 12 month period </select> Thanks,
4
1644
by: JamesB | last post by:
I have a form on a page that is built on results from a db query. The user can tick boxes/edit fields etc, and then submit to a second page that will update the db. How do I know what my POST fields are and how many in the second page (I am naming my fields in the form on the first by being a common name with a unique ID from each record on the front, ie. each record has a id_name, id_email etc etc. Yes, I'm a bit of a newbie to this......
1
5243
by: Finlay | last post by:
Hi Group I am designing a report that should show a meter reading for each month and the previous meter reading for the previous month. The months are text stored in a field tMonth. The current month is easy to pull out of the data base but I don't know how to get the previous months meter reading. The previous reading is subtracted from the current reading to get the
5
2626
by: LFM | last post by:
I have a table I'm importing from our SQL accounting database. The Employee Name is in one field. For the purpose of my needs, I need to extract the last name, first name and middle initial. So, if the name format is: LastName, Firstname MiddleInitial Example entries are: Doe, John Doe, John P Doe, John P.
4
63155
by: Ronald Celis | last post by:
Hi, is there anyway to get the Number of days in a given month and Year in C# thanks Ronald Celis
3
2467
by: Rameshika | last post by:
Hi All How can I select a particular row in a datagrid.Where when the user double clicks the data in that row should appear in the corresponding text boxes in runtime And how can the user insert,delete and edit fields in a datagrid at runtime Please be kind enough to help me Thanks Rameshika
4
10112
by: gabor | last post by:
hi, i'm trying to get the date of the day one month ago. for example: today = 12.apr.2006 one-month-ago = 12.mar.2006 so:
6
8084
by: Nkhosinathie | last post by:
hello guys,i've started with classes and i've been given this program below to program and also i will post the source code if you need it.this program reads as folllows. create a class called DATE that includs three pieces of information as data member a month(type int),a day(type int) and year(type int).your class should have a constructor with three parameters that uses the parameters to initialise the three data members,for the purpose of...
3
2741
MattFitzgerald
by: MattFitzgerald | last post by:
My Forms & Tables:- Main form is Frm_LE_List (contains Customer Details) Stored in Tbl_LE_List Which contains subform Frm_VOL_References (Contains Orders known as VOL's) Stored in Tbl_VOL_References This subform has subform Frm_Order_Lines (Contains line items for orders) Stored in Tbl_Order_Lines I also have a table Tbl_Rate_Card_Lookup (This contains information used to populate Tbl_Order_lines Relationships:- Tbl_LE_List is related...
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10378
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10391
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4333
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.