Yes/No select box (Full Version)

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



Message


jeffmetcalf -> Yes/No select box (3/25/2002 16:24:27)

can any one see whats wrong with this?

<%Dim fpforsale
fpforsale=FP_FieldVal(FP_rs,"ForSale")
%>
<select size="1" name="ForSale">
<option value="Yes" <%if fpforsale = "yes" then response.write "selected"%>>Yes</option>
<option value="No" <%if fpforsale = "no" then response.write "selected"%>>No</option>
</select></td>

have tried true/false, yes/no, 1/0 can't get anything to work.







Spooky -> RE: Yes/No select box (3/26/2002 0:54:06)

When in doubt, response write the value, itll show you the value returned.

<%Dim fpforsale
fpforsale=FP_FieldVal(FP_rs,"ForSale")
response.write fpforsale
response.end
%>

§þððk¥
Database / DRW Q & A
VP-ASP Shopping cart
Spooky Login




rdouglass -> RE: Yes/No select box (3/26/2002 11:13:01)

If you're using Yes/No fields from an Access DB, then you'd probably use:

<%Dim fpforsale
fpforsale=FP_FieldVal(FP_rs,"ForSale")
%>
<select size="1" name="ForSale">
<option value="Yes"<%if fpforsale = "True" then response.write(" selected")%>>Yes</option>
<option value="No"<%if fpforsale = "False" then response.write(" selected")%>>No</option>
</select></td>

 




jeffmetcalf -> RE: Yes/No select box (3/26/2002 12:22:01)

Here is what I have:

<% Dim fpShare
fpShare=FP_FieldVal(fp_rs,"ForShare")
%>

<input type='checkbox' name=ForSaleck <%if fpShare="True" then response.write "checked"%>
I get a blank box, whether using fpShare or FP_FieldVal(fp_rs("ForShare")

<% if FP_FieldVal(fp_rs,"ForShare")="True" then response.write "poo" else response.write "crap"%>

->evaluates to true and writes "poo"(actual value)
<% =FP_FieldVal(fp_rs,"ForShare")%>

->this also evaluates to true (actual value)
<% response.write FpShare%>

->evaluates to true (actual value)

but using either the var or the acutal value leaves me with a blank box.

http://www.getawayexchange.com/Prop_copy.asp
is the page.


Thanks






rdouglass -> RE: Yes/No select box (3/26/2002 12:32:14)

It looks like you're not closing your checkbox element properly and are missing some quotes. Try using:

<input type="checkbox" name="ForSaleck" <%if fpShare="True" then response.write("checked")%>>

Also as a general rule of thumb, I always encapsulate my response.writes with parens...

Edit: Hard to see difference, but notice the 2 >'s at the end of the line. It looks like you only had one.

Edited by - rdouglass on 03/26/2002 12:34:21




jeffmetcalf -> RE: Yes/No select box (3/28/2002 15:47:56)

thank you





Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.03125