•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,568 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,604 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1207 | Replies: 4 | Solved
![]() |
| |
Ok this may be a stupid questions. Is there a way to make a dynamic form? For example, if I wanted to create a form that took a users birthday, how do I make it so it would change the number of days in the month to correspond to the month selected. (with out having to submit the form). So if a user was to select their birth month as February it would put the number of days to 28. Any Ideas?
Thanx in advance
~Atrus
Thanx in advance
~Atrus
Last edited by atrusmre : Oct 25th, 2007 at 12:24 pm.
Thanx,
Atrus
Atrus
•
•
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,166
Reputation:
Rep Power: 7
Solved Threads: 59
javascript obviously.
This came from here:
http://www.hunlock.com/blogs/Javascr...lete_Reference
All you need to do is substitute this.getMonth() in the prototype with document.getElementById("usermonthdropdown").value
•
•
•
•
Javascript has a little quirk where a date of zero will set the date to be the last day of the previous month. Likewise is there are 30 days in a month and you set a date of 31 it will be the 1st day of the next month, a date of 40 would be the 10th day of the next month. This can lead to some very weird funkiness if you're not careful but we can definitely exploit this for a useful prototype which will give us the number of days in a specific month. We'll do this up as a prototype so it's available to all our Dates.
Date.prototype.daysInMonth = function () {
return new Date(this.getFullYear(), this.getMonth()+1, 0).getDate()
}
var d = new Date();
document.writeln('Number of days in this month: '+d.daysInMonth());This came from here:
http://www.hunlock.com/blogs/Javascr...lete_Reference
All you need to do is substitute this.getMonth() in the prototype with document.getElementById("usermonthdropdown").value
Last edited by hollystyles : Oct 25th, 2007 at 12:43 pm.
•
•
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,166
Reputation:
Rep Power: 7
Solved Threads: 59
>Is there anyway of doing it w/o java?
We *are* doing it without java! Javascript is *NOT* Java tsk.
I cannot think of any better solution than using javascript. You have to execute SOMETHING on the client if you don't want to postback server-side to do it. To do that you need to run a program. The options are:
Javascript (By far the most common sense solution)
Java Applet (overkill)
VBScript (IE browsers Only)
ActiveX Control (IE Only and overkill)
We *are* doing it without java! Javascript is *NOT* Java tsk.
I cannot think of any better solution than using javascript. You have to execute SOMETHING on the client if you don't want to postback server-side to do it. To do that you need to run a program. The options are:
Javascript (By far the most common sense solution)
Java Applet (overkill)
VBScript (IE browsers Only)
ActiveX Control (IE Only and overkill)
Last edited by hollystyles : Oct 26th, 2007 at 4:20 am.
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- How can show/view Infopath dynamic files(xml) without infopath in a computer (XML, XSLT and XPATH)
- oracle forms to PHP (PHP)
- Forms in Random access files (Visual Basic 4 / 5 / 6)
- Web App Testing Tools (PHP)
- Forms authorization, only want a few links (ASP.NET)
- Making T.Greer's JavaScript-synthesised combobox dynamic (JavaScript / DHTML / AJAX)
- Dynamic web pages? Which will exist? (IT Technologies and Trends)
Other Threads in the PHP Forum
- Previous Thread: Semantic Web - Final year project
- Next Thread: Gd



Hybrid Mode