|
-
Jul 2nd, 2002, 10:14 AM
#1
Thread Starter
Frenzied Member
Get form input values via their ID tag in Perl
I'm new to perl and I wrote a basic form parser library that extracts any form name/value pairs and returns them via a hash (attached, renamed from .lib to .txt). This works fine for form inputs with the NAME attribute, but using XHTML I want to replace NAME with ID. Is there anyway I can do it?
Here is the Perl file that extracts the arguments:
Code:
#/usr/bin/perl
use strict;
use CGI::Carp qw(fatalsToBrowser);
require "form_data.lib";
my %data = &parseForm;
my $loopItem;
print "content-type:text/plain\n\n";
foreach $loopItem (keys %data) {
print "$loopItem = $data{$loopItem}\n";
}
Last edited by Rick Bull; Jul 2nd, 2002 at 10:22 AM.
-
Jul 2nd, 2002, 04:14 PM
#2
I don't think you can. the name symbolizes the variable for the text field. if you have ID then it wouldn't be very symbolized I would think. if you could do it that way then you could get the ID of a frame or table or pretty much anything.
-
Jul 2nd, 2002, 04:57 PM
#3
Thread Starter
Frenzied Member
OK, thanks. I asked on another forum too, and they said not to bother, so I'll just stick to name.
-
Jul 3rd, 2002, 03:15 AM
#4
Fanatic Member
scouts right, you can't do it. Forms only work with the name attribute, not id.
Why dont you put both the id and name attributes in for backwards compatibility?
-
Jul 3rd, 2002, 06:10 AM
#5
Thread Starter
Frenzied Member
I might as well just use name init? I was only wanting to use ID because I don't think you can use name with XHTML 1.0 stict/XHTML 1.1 can you? I'll just use transitional for the FORM pages.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|