Hi all
I am making something for my webpage
Where the user can choose a month: I have made that with a dropdown box.
<select>
<option name = "1" value="1">Janua ry
<option name = "2" value="2">Febru ary
<option name = "3" value="3">March
<option name = "4" value="4">April
<option name = "5" value="5">May
<option name = "6" value="6">June
<option name = "7" value="7">July
<option name = "8" value="8">Augus t
<option name = "9" value="9">Septe mber
<option name = "10" value="10">Octo ber
<option name = "11" value="11">Nove mber
<option name = "12" value="12">Dece mber
</select>
The thing is:
I also want the user to choose a date
I will make this with another dropdownbox.
But if the first month is selected, then there should be 31 days in the days
dropdownbox, if the second month is selected there should be 28 days in the
dropdownbow.
I Know a little of python programming, but not to much, I have a feeling of
that I should use a cgi, can any explain me what I have to do :? Or give me
a link to a site where I can copy the code for it
All help will be greatly appreciated.
Thanks for your time
Jul 18 '05
15 1713 <select> <option name = "1" value="1">Janua ry <option name = "2" value="2">Febru ary <option name = "3" value="3">March <option name = "4" value="4">April <option name = "5" value="5">May <option name = "6" value="6">June <option name = "7" value="7">July <option name = "8" value="8">Augus t <option name = "9" value="9">Septe mber <option name = "10" value="10">Octo ber <option name = "11" value="11">Nove mber <option name = "12" value="12">Dece mber </select> The thing is: I also want the user to choose a date I will make this with another dropdownbox. But if the first month is selected, then there should be 31 days in the days dropdownbox, if the second month is selected there should be 28 days in the dropdownbow.
Python is great, but I'd suggest trying this with JavaScript and the DOM (Document Object Model). In fact you may be able to Google-up a JavaScript script that does what you want. JavaScript executes on the client machine, which is perfect for that aspect of your application.
The general idea would be to have the script redefine the option values fordays upon selection of the year and month. The DOM lets you access those <option>s at run time very easily.
JavaScript is not as robust a programming language as Python, but it is handy for executing certain functionality within a browser interface, and because it works within the browser and can access the DOM, there is an elementof instant gratification.
Then... about the time you start to try to build a real application with JavaScript, it will start to drive you mad... and you will have a new, greater affection for Python.
On Sat, 26 Mar 2005 18:07:01 -0800, EP wrote: Then... about the time you start to try to build a real application with JavaScript, it will start to drive you mad... and you will have a new, greater affection for Python.
Actually, if you dig into it really hard, it's not bad. In fact of all the
languages I know, Javascript is probably the closest to Python circa 1.5.2
that I can think of. Not identical, and it doesn't have *any* of the later
nice things in Python (metaclasses, descriptors, list comprehensions,
etc.), the OO can be clumsy (though it is fairly functional), and there
are inconveniences that I really wish I could make go away, but it's not
too bad.
(The worst being that
for (var something in someArray) {}
gives you the *indices* of the array, not the values, so the next line is
almost always
var theActualStinki ngValue = someArray[something];
..)
The DOM is clumsy, but for any given browser not to bad. The *differences*
in the DOMs from browser to browser are what kill you. And of course, no
real "libraries" .
Hi and thanks for your replies.
Will one still tell me how I use the timedate modul with my form
print '''<form action='inserte vent.py'><br>
<p>Day (1-31):<br> <INPUT type="text" NAME="day">
<p>Month (1-12):<br> <INPUT type="text" NAME="month">
print '''<p><input type=submit value='Submit'> </p></form>'''
------------------------------------------------------------------------------------------
It is starting to make a little sense. But its still not that clear...
If I import the DateTime or install and import the mx package.
Where should I then change something in my code?
I guess that I will have to see if the entered number is valid when the user
clicks the submit button.
So it must be when I run my insertevent.py script.
So will I have to import the DateTime modul in my form.script or in my
insertevent.scr ipt
And this maybe sound stupid, but will one pls give me an example of what the
code could be for maybe January and February.
I just cant figure out how they work together, the DateTime modul and the
html form.
The user can enter a number in the month field and in the day field. Then
there have to be a tjeck to see if the entered numbers are valid. If the
number entered in the month field is 1 and the number entered in the day
field is 32, there have to come anerror report, and the user will get a
second try to enter the right numbers.
And then if the entered numbers are correct, the data will be inserted in
the database ( But I will work on this if condition myself, I think I can
figure that out:)
"Jeremy Bowers" <je**@jerf.or g> wrote in message
news:pa******** *************** *****@jerf.org. .. On Sat, 26 Mar 2005 18:07:01 -0800, EP wrote: Then... about the time you start to try to build a real application with JavaScript, it will start to drive you mad... and you will have a new, greater affection for Python.
Actually, if you dig into it really hard, it's not bad. In fact of all the languages I know, Javascript is probably the closest to Python circa 1.5.2 that I can think of. Not identical, and it doesn't have *any* of the later nice things in Python (metaclasses, descriptors, list comprehensions, etc.), the OO can be clumsy (though it is fairly functional), and there are inconveniences that I really wish I could make go away, but it's not too bad.
(The worst being that
for (var something in someArray) {}
gives you the *indices* of the array, not the values, so the next line is almost always
var theActualStinki ngValue = someArray[something];
.)
The DOM is clumsy, but for any given browser not to bad. The *differences* in the DOMs from browser to browser are what kill you. And of course, no real "libraries" .
I figured it out with a lot of if else statements, but still if one have
time to explain how the time/date modul works with forms, I will be more
than happy to lear.
Thanks
"Hansan" <none> wrote in message
news:42******** *************** @nntp04.dk.teli a.net... Hi and thanks for your replies.
Will one still tell me how I use the timedate modul with my form
print '''<form action='inserte vent.py'><br> <p>Day (1-31):<br> <INPUT type="text" NAME="day"> <p>Month (1-12):<br> <INPUT type="text" NAME="month"> print '''<p><input type=submit value='Submit'> </p></form>'''
------------------------------------------------------------------------------------------ It is starting to make a little sense. But its still not that clear...
If I import the DateTime or install and import the mx package. Where should I then change something in my code? I guess that I will have to see if the entered number is valid when the user clicks the submit button. So it must be when I run my insertevent.py script. So will I have to import the DateTime modul in my form.script or in my insertevent.scr ipt
And this maybe sound stupid, but will one pls give me an example of what the code could be for maybe January and February.
I just cant figure out how they work together, the DateTime modul and the html form. The user can enter a number in the month field and in the day field. Then there have to be a tjeck to see if the entered numbers are valid. If the number entered in the month field is 1 and the number entered in the day field is 32, there have to come anerror report, and the user will get a second try to enter the right numbers.
And then if the entered numbers are correct, the data will be inserted in the database ( But I will work on this if condition myself, I think I can figure that out:)
"Jeremy Bowers" <je**@jerf.or g> wrote in message news:pa******** *************** *****@jerf.org. .. On Sat, 26 Mar 2005 18:07:01 -0800, EP wrote: Then... about the time you start to try to build a real application with JavaScript, it will start to drive you mad... and you will have a new, greater affection for Python.
Actually, if you dig into it really hard, it's not bad. In fact of all the languages I know, Javascript is probably the closest to Python circa 1.5.2 that I can think of. Not identical, and it doesn't have *any* of the later nice things in Python (metaclasses, descriptors, list comprehensions, etc.), the OO can be clumsy (though it is fairly functional), and there are inconveniences that I really wish I could make go away, but it's not too bad.
(The worst being that
for (var something in someArray) {}
gives you the *indices* of the array, not the values, so the next line is almost always
var theActualStinki ngValue = someArray[something];
.)
The DOM is clumsy, but for any given browser not to bad. The *differences* in the DOMs from browser to browser are what kill you. And of course, no real "libraries" .
Hansan wrote: I also want the user to choose a date I will make this with another dropdownbox. But if the first month is selected, then there should be 31 days in the days dropdownbox, if the second month is selected there should be 28 days in the dropdownbow.
I know this isn't the solution to your problem (the solution would be to use
JavaScript), but if I was a user, I'd rather type in the day number myself than
have to choose from a 31-long dropdown. Why don't you just give the user a text
field and then validate the input.
Just my 2 cents..
--
Timo Virkkala This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Leif K-Brooks |
last post by:
I'm writing a site with mod_python which will have, among other things,
forums. I want to allow users to use some HTML (<em>, <strong>, <p>,
etc.) on the forums, but I don't want to allow bad elements and
attributes (onclick, <script>, etc.). I would also like to do basic
validation (no overlapping elements like <strong><em>foo</em></strong>,
no missing end tags). I'm not asking anyone to write a script for me,
but does anyone have general...
|
by: Moosebumps |
last post by:
Is there a standard solution for writing HTML web pages with Python? I
don't know that much about web programming, but basically I want to generate
some internal reports on a web page.
It doesn't need to be fancy, just basic tables and linking, maybe indexing
and navigation, but I want it to all look nice and I want to be able to
change the formatting easily without combing through source code (hence my
next question about CSS).
I...
|
by: Michele Simionato |
last post by:
What is the recommended way of generating HTML from Python? I know of
HTMLGen and of
few recipes in the Cookbook, but is there something which is more or
less standard?
Also, are there plans to include a module for HTML generation in the
standard library?
I really would like to see some standardization in this area.
Michele Simionato
|
by: Ivan Voras |
last post by:
Is there a HTML clean/tidy library or module written in pure python? I
found mxTidy, but it's a interface to command-line tool.
What I'm searching is something that will accept a list of allowed tags
and/or attributes and strip the rest from HTML string.
|
by: Sullivan WxPyQtKinter |
last post by:
Hi, everyone. Simply put, what I need most now is a python lib to
generate simple HTML.
I am now using XML to store my lab report records. I found python
really convinient to manipulate XML, so I want to make a small on-line
CGI program to help my colleagues to build their lab report records
into XML, for storage, HTML display (for others to browse) and search.
With python's standard lib, the DOM object could realize the XML
storage...
| |
by: DH |
last post by:
Hi,
I'm trying to strip the html and other useless junk from a html page..
Id like to create something like an automated text editor, where it
takes the keywords from a txt file and removes them from the html page
(replace the words in the html page with blank space) I'm new to python
and could use a little push in the right direction, any ideas on how to
implement this?
Thanks!
|
by: sebzzz |
last post by:
Hi,
I'm doing a little script with the help of the BeautifulSoup HTML
parser and uTidyLib (HTML Tidy warper for python).
Essentially what it does is fetch all the html files in a given
directory (and it's subdirectories) clean the code with Tidy (removes
deprecated tags, change the output to be xhtml) and than BeautifulSoup
removes a couple of things that I don't want in the files (Because I'm
stripping the files to bare bone, just...
|
by: Tim Arnold |
last post by:
hi, I've got lots of xhtml pages that need to be fed to MS HTML Workshop to
create CHM files. That application really hates xhtml, so I need to convert
self-ending tags (e.g. <br />) to plain html (e.g. <br>).
Seems simple enough, but I'm having some trouble with it. regexps trip up
because I also have to take into account 'img', 'meta', 'link' tags, not
just the simple 'br' and 'hr' tags. Well, maybe there's a simple way to do
that...
|
by: John Krukoff |
last post by:
-----Original Message-----
One method which wouldn't require much python code, would be to run the
XHTML through a simple identity XSL tranform with the output method set to
HTML. It would have the benefit that you wouldn't have to worry about any of
the specifics of the transformation, though you would need an external
dependency.
As far as I know, both 4suite and lxml (my personal favorite:
|
by: M.-A. Lemburg |
last post by:
On 2008-04-24 19:16, John Krukoff wrote:
You could filter the XHTML through mxTidy and set the hide_endtags to 1:
http://www.egenix.com/products/python/mxExperimental/mxTidy/
--
Marc-Andre Lemburg
eGenix.com
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
| |
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
|
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...
| |