Results 1 to 5 of 5

Thread: Get form input values via their ID tag in Perl

  1. #1

    Thread Starter
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444

    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.

  2. #2
    scoutt
    Guest
    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.

  3. #3

    Thread Starter
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    OK, thanks. I asked on another forum too, and they said not to bother, so I'll just stick to name.

  4. #4
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    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?
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  5. #5

    Thread Starter
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    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
  •  



Click Here to Expand Forum to Full Width