Jump to content

Recommended Posts

Hi everyone,

 

I'm working on an edit inventory form, and I'm pulling a field from my database that's going to be a 'Y' or 'N'.  Based upon this, I want to default the 'customizable' radio button to either checked="Y" or checked="N".

 

<tr valign="baseline">
      <td align="right" valign="top" nowrap="nowrap">Customizable:</td>
      <td valign="baseline"><table>
        <tr>
          <td><input onclick="document.form1.character_limit.disabled = false" type="radio" name="customizable" value="Y"/>
            Yes</td>
            <?php if ($row_rs_edit_inventory['customizable']=='Y') {
    ?>
       <script>
               document.form1.customizable.checked='Y'
               </script>
           <?php }else{
   ?>
               <script>
               document.form1.customizable.checked='N'
               </script>  
           <?php }
   ?>
        </tr>
        <tr>
          <td><input onclick="document.form1.character_limit.disabled = true" type="radio" name="customizable" value="N"/>
            No</td>
        </tr>
      </table></td>
    </tr>

 

Not sure why, but this isn't working.  No matter what's in the database, the radio button is defaulting to 'Y'.  Does it matter whether I place this code in the 'Y' input portion of the radio button or the 'N'?  Should I put it before both inputs?  Not sure.

 

I'm also pretty sure I'm going about this the hard way.  Any ideas?

 

Thanks in advance.

 

EDIT:  Came up with something else (much simpler), but it doesn't work either:

 

<script>
   if <?php echo $row_rs_edit_inventory['customizable']; ?>=='Y'
   document.form1.customizable.checked='Y'
   else
   document.form1.customizable.checked='N'
</script>

 

Sorry in advance is this is all newbie stuff, I'm still learning.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.