I have a date field and in the add or modify record subroutines I want the user to be able to select from drop down or enter a new value so i have a build_select_from_db beside a text field. My problem is that if the user enters a new value and does not set the drop down to "---" both values are written to the db. ie "03-Mar-1999|03-Mar-1999" is the new entry. How can I fix this?
Mar 9, 1999, 8:20 AM
Veteran / Moderator (8669 posts)
Mar 9, 1999, 8:20 AM
Post #2 of 2
Views: 433
If you want the date entered in the text field to have priority over what is in the select field, rename the text field to "new_date"--
<input type=text name="new_date">
Don't put a value in there.
Then in db.cgi, look for sub &parse_form. (It's almost at the end of the file.) At the end of the subroutine, just before
return %in;
add
$in{'Date'} = $in{'new_date'};
}
------------------
JPD
<input type=text name="new_date">
Don't put a value in there.
Then in db.cgi, look for sub &parse_form. (It's almost at the end of the file.) At the end of the subroutine, just before
return %in;
add
Code:
if ($in{'new_date'}) { $in{'Date'} = $in{'new_date'};
}
------------------
JPD

