Gossamer Forum
Home : Products : Gossamer Links : Discussions :

calculus on fields when inserting links

Quote Reply
calculus on fields when inserting links
HI,

I have created three new fields $field1, $field2, $field3 on related to the Links table. They appear on the form and its OK.

What I would like to do is to have have this calculus made
$field3 = ($field1 + $field2)/2 when the user calick on "Add links" button

(in reality there are more than two fields and the calculus is a bit more complicated)

An I would like to have visible for th user when he sees the data entered.

Where should include this calculus? In the add_record function ? in the format_insert_cgi?

Thanks in advance for your answers.

vercyb
Quote Reply
Re: [vercyb] calculus on fields when inserting links In reply to
I think the easiest way to do this would be to use some javascript.
Otherwise I think you'll probably need a plugin or to replace add.cgi.
Quote Reply
Re: [afinlr] calculus on fields when inserting links In reply to
I have tried to modify the Add.pm file located in

adding this line to the add_link function
$input->{'champ3'}=($input->{'champ1'} + $input->{'champ1'})/2;
and nothing happens.

I have even tried to cancel this file and its still possible to add some links without any problem.

What happens?