Gossamer Forum
Home : Products : DBMan : Customization :

Build_select and text input?

Quote Reply
Build_select and text input?
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?
Quote Reply
Re: Build_select and text input? In reply to
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

Code:
if ($in{'new_date'}) {
$in{'Date'} = $in{'new_date'};
}




------------------
JPD