Results replaced by dropdown menu on edit page (Full Version)

All Forums >> [Web Development] >> ASP, PHP, and Database



Message


Mav44 -> Results replaced by dropdown menu on edit page (9/28/2009 19:26:42)

I am using the code below to pull the data back to the orignal page for editing. All the results are coming back fine except where I have drop down menus. On those the recalled data is replaced by the initial state of the drop down menu, in most cases "select".

Any Ideas are appreciated!

if st = "edit" then
id = request.querystring("id")' request the id of the record you need to change
sql = "select * from doghouse where id = " & id ' select the single record
set rs = myconn.execute(sql)
a_region = trim(rs("a_region"))
b_distributor = trim(rs("b_distributor"))
c_salesman = trim(rs("c_salesman"))
d_series = trim(rs("d_series"))
etc,etc




Mav44 -> RE: Results replaced by dropdown menu on edit page (9/29/2009 1:15:02)

Looks like I may have jumped the gun and it is my results in the menu that I need to figure out how to handle. If there is a result in the table I want the top selection of the menu to be that result. If there is no reulst in the table I want the table to say "Select".

This almost works

<option selected value="a_region">Select$<%=a_region%></option>

but I end up with both Select$ and my Table Result.

I am thinking I may need some type of >0 statement to get my menu to use the result if found and if not to default to select.

Full menu code below

<label>
<select name="a_region" size="1" id="<%=a_region%>">
<option selected value="a_region">Select$<%=a_region%></option>
<option value="East">East</option>
<option value="Midwest">Midwest</option>
<option value="South">South</option>
<option value="West">West</option>
</select>
</label>




Mav44 -> RE: Results replaced by dropdown menu on edit page (9/29/2009 20:20:09)

Still banging my head on the desk with this one. I have been trying new code all day and the one before with the $ comes close but brings back in both results "Select" and the "Region"

I have been trying something like

<label>
<select name="a_region" size="1" id="<%=a_region%>">
<option selected value=""><%If ("a_region") > 0 Then %>
<%=a_region%><%End If%>Select$<option>
<option value="East">East</option>
<option value="Midwest">Midwest</option>
<option value="South">South</option>
<option value="West">West</option>
</select>
</label>

But I think this is way off base.

Maybe something Like


<option selected value="<%=a_region%>" <%If isNull Then :Response.Write("")%>>Select</option>



Please help before they lock me up[:D]




Mav44 -> RE: Results replaced by dropdown menu on edit page (9/30/2009 11:37:40)

I am still fighting this demon this morning. My latest direction has me trying something like,

<label>
<select name="a_region" size="1" id="<%=a_region%>">
<option value="" selected><if ("a_region")="NULL" then Response.Write("Select")else Response.Write("a_region") end if></option>
<option value="East">East</option>
<option value="Midwest">Midwest</option>
<option value="South">South</option>
<option value="West">West</option>
</select>
</label>

Still not working. Can anybody make a suggestion, Spooky, BtheBall, Texan??????




ou812 -> RE: Results replaced by dropdown menu on edit page (9/30/2009 11:55:01)

I'm not exactly sure what you're trying to do. If I'm understanding you seem to be really close. Maybe something like this:
<% if (len(a_region & "") = 0) then %>
    <option value="" selected>Select</option>
<% else %>
    <option value="" selected> <%= a_region%></option>
<% end if %>


I broke it out just for easier reading for me. Again though, not sure if that is what you're looking for.




Mav44 -> RE: Results replaced by dropdown menu on edit page (9/30/2009 12:03:37)

That is exactly what I was trying to do!!!!!

Thanks for your help, you made my day!




ou812 -> RE: Results replaced by dropdown menu on edit page (9/30/2009 12:23:27)

Excellent. Glad it worked for you!

I was getting tired of watching you talk to yourself [:D] so I thought I should step in.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625