Skip to main content
Participant
May 3, 2009
Question

Convert 1 to Yes and 0 to No

  • May 3, 2009
  • 2 replies
  • 908 views

I usually have the checkboxes but this time I want the value to be Yes or No. So how does one go about changing this to Yes or No:

<?php echo $row_Properties['active']; ?>

Thanks

David

This topic has been closed for replies.

2 replies

David_Powers
Inspiring
May 4, 2009

If you want the value to be yes or no, use a radio button group. All buttons in a radio button group have the same name, but only one radio button can be selected in the form.

The following help page describes how to set the value of a dynamic radio button group: http://help.adobe.com/en_US/Dreamweaver/10.0_Using/WSAE53B9C0-A21B-4c4c-96AC-23293D003085.html.

davidlefAuthor
Participant
May 4, 2009

I'm sorry about my question. What I want to do is display what I would normally put in a checkbox so if the value is 1 then the box would be checked. In this case I don't want the people to think they can uncheck/check the box to change the value, I just want to show them what the value is either Yes or No. So I need to take that 1 and display it as a Yes and the zero to No. I hope that makes sense. Again I apologize for my poor explanation, especially when asking for your time and help.

So I think you've given me the answer DWFAQ.info, thank you.

David_Powers
Inspiring
May 4, 2009

Yes, that's the basic principle of hand-coding it. Dreamweaver will also create the code for you automatically.

  1. Select the checkbox, and click the Dynamic button in the Property inspector.
  2. Click the lightning bolt icon in the Dynamic Checkbox dialog box to select your recordset field
  3. Type the value you want to use for the checkbox to be marked checked, as shown in the following screenshot:

Since you don't want the value to be changed, select the <input> tag in the Tag selector, right-click, and select Quick Tag Editor. Add readonly="readonly" to the <input> tag.

DwFAQ
Participating Frequently
May 3, 2009

Do you mean change the form checkbox value to yes and no? Your post reads like it but doesn't seem like it sense that's as easy as changing values to yes and no.

If you already have a database with values for a column as 1 and 0 that you want displayed as Yes and No on your page you can use a conditional region to display the database values as Yes and No.

So your conditional region code will look something like this:

<?php

// Start Conditional Region

if (@$row_Properties['active'] == 1) {

?>

yes

<?php

// else

} else { ?>

no

<?php }

// End Conditional Region

?>