473,480 Members | 1,836 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem with Form?

12 New Member
Hi there,

I've really not had much to do with this before, but I've been trying to convert a form for use by a local charity and it appears just not to work:
http://www.p-s-i.org.uk/temp/email.html

If anyone could help I would be grateful.

Many thanks,
D
Mar 16 '09 #1
1 1006
acoder
16,027 Recognized Expert Moderator MVP
The function you're using is as follows:
Expand|Select|Wrap|Line Numbers
  1. function PostCodeInSwindon() {
  2. // code here something to extract the first (non-blank) four characters of the postcode
  3. postcode=document.getinput.postcode.value;
  4. postcode=postcode.toUpperCase()+'      ';
  5. postcode=postcode.substring(0,4);
  6. InSwindon=false;
  7. // check for those postcodes in Swindon
  8. switch(postcode) {
  9.     case "SN1":
  10.         InSwindon=true;
  11.         break;
  12.     case "SN2":
  13.         InSwindon=true;
  14.         break;
  15.     case "SN3":
  16.         InSwindon=true;
  17.         break;
  18.     case "SN4":
  19.         InSwindon=true;
  20.         break;
  21.     case "SN5":
  22.         InSwindon=true;
  23.         break;
  24.     case "SN25":
  25.         InSwindon=true;
  26.         break;
  27.     case "SN26":
  28.         InSwindon=true;
  29.         break;
  30. }
  31. // display the processed postcode
  32. getinput.processed.value=postcode;
  33. // display a different result in an input box depending on whether the postcode is in Swindon or not
  34. if (InSwindon) {getinput.result.value="Swindon"}
  35. else {getinput.result.value="Not Swindon"}
  36. // call a different file depending on whether the postcode was in Swindon or not
  37. if (InSwindon) {destinationpage = "swindonemail.html" + "?Swindon"; top.location.href = destinationpage }
  38. else {top.location = "noemail.htm"}
  39. return
  40. }
and it's called here:
Expand|Select|Wrap|Line Numbers
  1. <FORM NAME="getinput" onSubmit="PostCodeInSwindon(); return false;" enctype="text/plain">
One problem is that it should be:
Expand|Select|Wrap|Line Numbers
  1. onsubmit = "return PostCodeInSwindon();"
Another is that getinput is not global: you need to use document.getinput to refer to the form.

Yet another problem is that you've got 4 characters from the postcode, but you're only checking for 3 (for most of the cases in the switch statement).
Mar 17 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
2293
by: Aaron Prohaska | last post by:
I have just run into a problem where I have a page that posts back to itself to execute code, except when the page does the post back it somehow executes code that is in our home page for the site....
0
6447
by: CSDunn | last post by:
Hello, I have a problem with field filtering between an Access 2000 Project form (the application is called CELDT), and the report that shows the results of the filter. Both the form and the...
4
4019
by: William Wisnieski | last post by:
Hello Everyone, Access 2000 I have a form with multiple pages on it. There is one text field on the third page of the form that I need the user to complete before leaving the form or moving...
3
2656
by: dixie | last post by:
I have an Access 2000 form which has been running OK for a long time. Lately, it is playing up and doing things like causing Access to close suddenly when the form is opened or when saving the form...
9
2799
by: Rajat Tandon | last post by:
Hello there, I am relatively new to the newsgroups and C#. I have never been disappointed with the groups and always got the prompt replies to my queries.This is yet another strange issue, I am...
7
2626
by: Frank Maxey | last post by:
I am fairly new to VB.Net and am having a curious problem. I have an entry dialog form called from a main form. The calling form needs to check the DialogResult field for an OK response. In...
7
1746
by: Trickynick1001 | last post by:
Hi, a newbie here. I don't have a real firm grasp on the idea of Javascript, as I'm used to programming in Qbasic and C. I'm not used to OOP. Anyway, I really don't have any idea what the...
9
9663
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
7
10217
xNephilimx
by: xNephilimx | last post by:
lHi guys! I'm having a little problem that's getting on my nerves, I couldn't find a solution, I also tryed googling it and I found nothing... (my field of expertise is in AS 2 and 3, but I still...
1
1334
by: swathichavalla | last post by:
Problem description: Clients working with an apple computer with the safari browser are experiencing problems with brokerage orders. When the client wants to enter a stock order, the order entry...
0
7054
marktang
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,...
0
6918
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...
0
7102
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...
1
6756
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...
0
7003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4798
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...
0
4495
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...
0
3000
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
199
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...

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.