Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Possible Hidden Field Bug

Quote Reply
Possible Hidden Field Bug
Not sure if anyone else has run into this problem but the following hidden field code seems to have a bug, either that, or I don't understand what it's supposed to do.
Quote:
# Display a hidden field.
elsif (${$self->{'db_form_len'}}{$field} == -1) { $output .= qq~<input type=hidden name="$field" value="$value_q">$output\n~; }

The final $output is causing all the other fields to repeat over and over and over. I set 8 fields to hidden and 1 minute later, I still had no form, but had loaded over 400k of information. I removed it and it worked fine. What's it for? Should it be left in for some reason?

I also found that setting a drop down menu or checkbox field to -1 didn't give me a hidden field either so I moved the location of the code to just above:
Quote:
# Display a select list.

Now the select fields, checkboxes and radio buttons will be hidden if selected.

Finally, none of the above had any effect on any field that used a user defined subroutine.

Quote:
# Run a user defined subroutine if a subroutine exists.
if (ref $opt->{$field} eq 'CODE') { $output .= &{$opt->{$field}}($name, $value, $rec); }

so I changed it to read
if ((ref $opt->{$field} eq 'CODE') and (${$self->{'db_form_len'}}{$field} >= 0)) { $output .= &{$opt->{$field}}($name, $value, $rec); }


Now, with all this -- setting a field to -1 will indeed make any chosen field hidden.

Peace.

Kyle

[This message has been edited by klangan (edited March 07, 2000).]
Quote Reply
Re: Possible Hidden Field Bug In reply to
First, where is this code?

Second, I'm going to have to leave that for Alex Smile

That's really internal logic, and I have to admit I'm not a wiz with that sort of stuff.

There are some small bugs in logic -- it's unavoidable -- and not all are found until someone actually tries to use them!

What I don't understand is why it would cause the fields to repeat. All this is doing is outputting the HTML, and setting the attribute of the field to "hidden" so it doesn't visibly display in the browser.

Do you have a copy of the original file to make sure you didn't accidentally make a change that affected the output?




------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: Possible Hidden Field Bug In reply to
Yeah, should have said where the code was, I thought about that at around 3 am.

The code is in dbsql.pm.
sub build_html_record_form {

}

I did check my original. (I always make a duplicate and use it for reference specifically for this type of situation).

The problem is with the final $output in this line.

# Display a hidden field.
elsif (${$self->{'db_form_len'}}{$field} == -1) { $output .= qq~<input type=hidden name="$field" value="$value_q">$output\n~; }





You see, $output already contains a bunch of information from previous fields that have already been foreached. Once it gets to the hidden fields, it say to itself, make this field hidden and print out everything else in $output.

Quirky little logic bugger, but confusing wierd and potentially server annoying if you try to use it and don't fix it.

Hope that explains it a bit better.

I did get it fixed as explained above and haven't had any problems since. I am curious however if it was just a left over/oversight or if it really belongs there for some reason I don't understand.


Peace.

Kyle.


[This message has been edited by klangan (edited March 08, 2000).]