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

Validation: Change 'Add Date' to today

Quote Reply
Validation: Change 'Add Date' to today
I often get behind validating links, and if I validate a link that's over my 30 day "New" limit, it doesn't show up in the new listings (so it can look like I haven't added any links lately).

Is it possible for the 'Add Date' field to be set to TODAY'S DATE when I validate a record?

All the best
Shaun

Quote Reply
Re: Validation: Change 'Add Date' to today In reply to
Well, after playing around for a while I finally figured it out. Here it is if anyone wants it:

Admin_HTML.pm under sub html_validate_form

... add the bit of code in bold ...

Code:
$record = $val->array_to_hash ($record);
$form = $db->build_html_record_form ($record, { multiple => 1, hide_key => 1, CategoryID => \&build_category_row_val, today => 1 });
if ($db->{attach_dir}) {
(This is so it only changes 'Add_Date' when you are Validating a record, otherwise it gets changed for every instance of the form)

DBSQL.pm

Add this above # Convert to hash ref if passed array ref.

Code:
$today = &get_date();
Now find ...

Code:
# Display a hidden field.
elsif (${$self->{'db_form_len'}}{$field} == -1) { $output .= qq~<input type=hidden name="$field" value="$value_q">$output\n~; }
... and insert the following line directly after it ...

Code:
# Display Add_Date with todays date when validating a record.
elsif (($field eq 'Add_Date') and $opt->{'today'}) { $output .= qq~<tr><td align=right valign=top width=20%><$font>$field:</font></td><td width=80%><input type=text name="$name" value="$today" size="~ . ${$self->{'db_form_len'}}{$field} . qq~" maxlength="~ . ${$self->{'db_max_length'}}{$field} . qq~"></td></tr>\n~; }

That's it.

All the best
Shaun

Quote Reply
Re: Validation: Change 'Add Date' to today In reply to
I believe that pugdog recently posted a fix for this in this forum.

Regards,

Eliot Lee

Quote Reply
Re: Validation: Change 'Add Date' to today In reply to
I think my 'fix' was for the problem of ordering the records in the Validate database, and getting the 'modify' records to show ahead of 'new' additions. I still change the "Add_Date" by hand, since I like to know what date a link was added, even if I have it on-hold for a long, long time <G>



http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/