I'm having problems with my error handling. It's kind of hard to explain so I'll just post my code and bold where the error handling is and then explain what is happening.
Just to warn you, I am new to Perl so the code probably will be ugly!
So, the problem lies with the error handling. On the first page, I have the user enter the number of elements they want to be added together and averaged. Then, I have some error handling that checks to see if the user entered something. If they didn't, then it displays "Invalid number of elements!". Else, it calls page2. In page2, I have a for loop that displays the number of textboxes needed for the user to enter the elements. Here, when they hit submit after entering in the elements, it shows the "Invalid number of elements!" error again and I don't know why. I'm assuming it has something to do with the previous error handling, but I don't know how to fix it.
8 1761
The strict and warnings pragmas will help you catch some of the obvious and not so obvious problems. I recommend that you start using those.
Also, where are you declaring the hash %FORM that holds the form data?
--Kevin
The strict and warnings pragmas will help you catch some of the obvious and not so obvious problems. I recommend that you start using those.
Also, where are you declaring the hash %FORM that holds the form data?
--Kevin
I haven't learned anything about the hash. How exactly would that work?
I'm having a different problem now with storing the inputs on page2. After the user inputs the numbers and clicks submit, it does the for loop again or something so if the first text box contained the number 3, it will reprint 3 text boxes (while there was 2 before).
Should I be putting in something like require "subparseform.lib"; in the code?
Maybe @elements = values{%FORM}; too?
Ewish:
Didn't you notice the URL the form tag points to?
http://cs.sunyit.edu/~westj2/cgi-bin/assignment4.pl/page2
;)
Ewish:
Didn't you notice the URL the form tag points to?
http://cs.sunyit.edu/~westj2/cgi-bin/assignment4.pl/page2
;)
Where should it be pointed to then? I deleted the /page2 part from all of the form tags and now I'm getting a document not found error.
I think the main problem lies within the for loop. If I knew how to store the numbers the user inputs into the text boxes on page2, then I would be able to continue on with the rest of the program.
I think the main problem lies within the for loop. If I knew how to store the numbers the user inputs into the text boxes on page2, then I would be able to continue on with the rest of the program.
The user inputs the number of elements to add. The value of the input (from the textbox "numelements") gets sent to subroutine page2. In sub page2, the user inputs however many numbers they specified in "numelements". In the for loop to do this, the textbox "numelements" is printed that many times. How would I change the name of the textbox for all of the textboxes printed out? I think the problem is that the first textbox on page2 overwrites numelements instead of being saved as its own. Then, the for loop takes that input... I don't know.
Where should it be pointed to then? I deleted the /page2 part from all of the form tags and now I'm getting a document not found error.
Just letting Ewish know that you are working on school/class/course work. At least you are giving it a try.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Christian Christmann |
last post by:
Hi,
assert and error handling can be used for similar purposes.
When should one use assert instead of try/catch and in which
cases the error handling is preferable?
I've read somewhere that...
|
by: Julia Baresch |
last post by:
Hi everyone,
As some of you may know, we've been having trouble with an
unrecognized database format error.
Today I installed an unfinished project on the workstation of one of
my users. ...
|
by: Squirrel |
last post by:
I have a command button on a subform to delete a record.
The only statement in the subroutine is:
DoCmd.RunCommand acCmdDeleteRecord
The subform's recordsource is "select * from tblVisit order...
|
by: Thelma Lubkin |
last post by:
I use code extensively; I probably overuse it. But I've been using
error trapping very sparingly, and now I've been trapped by that.
A form that works for me on the system I'm using, apparently...
|
by: TD |
last post by:
This is the code under a command button -
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.BackColor <> RGB(255, 255, 255) Then
ctl.BackColor = RGB(255, 255, 255)
End If
Next ctl
|
by: Spacen Jasset |
last post by:
The main two desirable things I feel error handling should provide are
these:
1) Debugging and diagnostic aid
2) User feedback
One method that is used a fair amount it to 'say' that all...
|
by: tiger79 |
last post by:
Hello,
I'd like to know what the C# counterpart is for the VB On Error statement ?
My VB code looks like this :
On Error GoTo ErrGetItem
plain simple ud say, but I need to "translate" it into...
|
by: adam.timberlake |
last post by:
I've just finished reading the article below which goes into some
depth about exceptions. The article was rather lucid and so I
understand how to implement it all, the thing I'm having trouble with...
|
by: sean_walsh |
last post by:
Hi
From classic ASP, I had a custom error handling situation that was
quite simple. Errors were all redirected to Error.asp. This page would
check 2 settings, EmailErrorMessage and...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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,...
|
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...
|
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...
| |