For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > March 2004 > Question about cgi forms (slightly OT)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Question about cgi forms (slightly OT)
Mike

2004-03-26, 11:14 pm

I am developing a cgi/DBI app which is nearly finished

I have this one question

The scenario

I have a cgi generated form on a web-page, it consists of several
records defined by a DB lookup.

When I do Search in the web-browser, is there any way to get it to
search the values in the fileds of the form?

Currently all the values show up, but they dont seem to appear to be in
scope for searching

thanks for any tips (and apologies for vaguely OT)
Wc -Sx- Jones

2004-03-26, 11:14 pm

mike wrote:

> When I do Search in the web-browser, is there any way to get it to
> search the values in the fileds of the form?
>
> Currently all the values show up, but they dont seem to appear to be in
> scope for searching



Show some code -- likely your logic is wrong -- if using CGI module
then capture all params in a single arrary, or hash, then walk
thru the data.

If you normalize the CGI input to a sane value (IE, make string zero
numeric 0 and undefined input as empty strings) you can control
the order they are placed into the array then you can use array
index to make sure you are looking at the right array to CGI
input values.

HTH

--
_Sx_ http://youve-reached-the.endoftheinternet.org/ _____
perldoc -qa.a | perl -lpe '($_)=m("(.*)")' | grep Martian
Mike

2004-03-26, 11:14 pm

On Thu, 2004-03-25 at 13:18, WC -Sx- Jones wrote:
> mike wrote:
>
>
>
> Show some code -- likely your logic is wrong -- if using CGI module
> then capture all params in a single arrary, or hash, then walk
> thru the data.
>
> If you normalize the CGI input to a sane value (IE, make string zero
> numeric 0 and undefined input as empty strings) you can control
> the order they are placed into the array then you can use array
> index to make sure you are looking at the right array to CGI
> input values.
>
> HTH
>


dont think I was clear enough

this creates the form

print start_multipart_form (POST,'con_role_upd.pl');
print "Choose Id",textfield('id2','0');
print "<br />";
print "<BR />";
#@value=param();
#print @value;
$row1=$dbh->prepare("SELECT
tb_contact_role. id,contact_id,type_of_contact,descriptio
n,priority FROM
tb_contact_role LEFT JOIN lk_sort_of_contact ON
type_of_contact=type_code WHERE contact_id ILIKE ?");
my $idsel=$id;
$row1->bind_param(1,$idsel);
$row1->execute();
while(($id1,$contact_id1,$type_id,$type,
$priority) =
$row1->fetchrow_array()) {
#print $id1,$contact_id1,$type,$priority;
print font {-style=>'background-color: #F8FC8C;color: blue'};
print "Roles for Contact";
print end_font;
print p;
print font {-style=>'background-color: white;color: blue'};
print "Role
ID",textfield(-name=>'id1'.$id1,-value=>$id1,-style=>'background-color:
#C59E65;color: white');
print "Role
ID",textfield(-name=>'type_id1'.$id1,-value=>$type_id,-style=>'background-color: #C59E65;color: white');
print "Type of
Contact",textfield(-name=>'type'.$id1,-value=>$type,-style=>'background-color: #C59E65;color: white');
print
"priority",textfield(-name=>'priority'.$id1,-value=>$priority,-style=>'background-color: #C59E65;color: white')};
print br;
print br;
print br;
}
print submit;
print end_form;

This results in a html page of forms which is populated, I can tab
through the fields, edit etc, but if I do a control F for instance, the
values in the fields are not found.

What I would like is for users to be able to search for a value and then
go tothat record



> --
> _Sx_ http://youve-reached-the.endoftheinternet.org/ _____
> perldoc -qa.a | perl -lpe '($_)=m("(.*)")' | grep Martian

Wc -Sx- Jones

2004-03-26, 11:14 pm

mike wrote:

> This results in a html page of forms which is populated, I can tab
> through the fields, edit etc, but if I do a control F for instance, the
> values in the fields are not found.
>
> What I would like is for users to be able to search for a value and then
> go tothat record


I was afraid that was what you meant. :)

It is totally OT now because what you want is to chamge / control
the client side and you can't -- unless you do what the OP
stated - explode the current/old values out beside the input
fields as plain text.

Otherwise you will need client-side JS and DCOM programming; see

http://www.mozilla.org/projects/xpc...ts.html#1000194

Some modification of that or maybe something from here:

http://javascript.internet.com/forms/

--
_Sx_ http://youve-reached-the.endoftheinternet.org/ _____
perldoc -qa.a | perl -lpe '($_)=m("(.*)")' | grep Martian
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com