Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Edit record in db - dropdown doesn't specifiy what was chosen

Status
Not open for further replies.

GoDario27

Programmer
Aug 7, 2006
3
US
I have a db that I used the FP2000 Database Interface Wizard on. All is well and it lets me view/update/delete fields from the db. (not a problem).

When I generated it, though, it had me choose how many fields would be in my drop-down boxes and named each choice "Option 1", "Option 2", etc. (still not a problem!)

On the forms, I edited the generic options to match the ones in my db and it worked well. (even still not a problem!)

However, on the "update" form, it will go to the db and look at the record I want to edit and populate the fields with its data -- so when I click "edit" I can see what the data for each field is and submit a change, if necessary. (still good so far...)

For the drop-down boxes, though, it will show all of the choices, but will not show which "option" was selected in the record. It defaults to the first "option" (which may/may not be correct) and before I submit the form, I have to drop down each of the drop-down boxes and re-select the correct "option", even though it may have already been correct in the original record. (?!)

Do I confuse? I've provided the code (that had generic info in it and I edited). -- Is there some way to have it check the original record in the db and return the "option" that was selected -- so I could choose to edit it or not? (??)

EXAMPLE: db field = status
drop-down box choices = new, closed

<select size=&quot;1&quot; name=&quot;Status&quot;>
<option <% if &quot;New&quot; = FP_Field(fp_rs,&quot;Status&quot;) then %> selected <% end if %> value=&quot;New&quot;>New</option>
<option <% if &quot;Closed&quot; = FP_Field(fp_rs,&quot;Status&quot;) then %> selected <% end if %> value=&quot;Closed&quot;>Closed</option>
</select>

Am I way off base?

Any clues/answers you could give me would be *greatly* appreciated!

~asp newbie, but trying!

 
is that example code something that you wrote or did FrontPage write it?
Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
What does FP_Field(fp_rs,&quot;Status&quot;) refer to?

Can you access the recordset directly?

Code:
if ucase(fp_rs(&quot;Status&quot;)) = &quot;NEW&quot; then

The code looks good as long as the FP_Field function returns the correct data. Test your code by doing a
Code:
response.write FP_Field(fp_rs,&quot;Status&quot;)
to see what is being returned. This may give you a clue to what is going on.

Thanks,

Gabe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top