Need Help with inserting data in hidden field based upon radio button selection.

I have a form created with Adobe Dreamweaver Developer's Toolbox with a radio group where the user can select one of 5 selections.  Four of the answers result in a 'y' value and one results in a 'n' value for a "licensed" field.  Based upon this y or n value I want to insert the value "Contractor" or "Associate" to a  "membertype" field in my MySql database. The "membertype" field is included in the form as a hidden field.   I have made several attempts with <cfif> and IIF statements to try and set the value of the hidden field, however, I am unable to capture the value of "licensed", and the if statement always defaults to the "else" value.

I am attaching my code, without my if statement attempts, and would appreciate someone could give me the proper code to accomplish my goal.

<cfinclude template="../includes/common/KT_common.cfm">
<cfinclude template="../includes/tng/">
// Make a transaction dispatcher instance
tNGs = Request.tNG_CreateObject("tNG_dispatcher");
// Start trigger
formValidation = Request.tNG_CreateObject("triggers.tNG_FormValidation");
// End trigger
// Make an insert transaction instance
ins_nari_company = Request.tNG_CreateObject("tNG_insert");
// Register triggers
ins_nari_company.registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
ins_nari_company.registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, formValidation);
ins_nari_company.registerTrigger("END", "Trigger_Default_Redirect", 99, "../login.cfm");
// Add columns
ins_nari_company.addColumn("company_name", "STRING_TYPE", "POST", "company_name");
ins_nari_company.addColumn("licensed", "STRING_TYPE", "POST", "licensed");
ins_nari_company.addColumn("membertype", "STRING_TYPE", "POST", "membertype");
ins_nari_company.setPrimaryKey("id", "NUMERIC_TYPE");
// Execute all the registered transactions
// Get the transaction recordset
rsnari_company = tNGs.getRecordset("nari_company");
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="../includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" />
<script src="../includes/common/js/base.js" type="text/javascript"></script>
<script src="../includes/common/js/utility.js" type="text/javascript"></script>
<script src="../includes/skins/style.js" type="text/javascript"></script>
<form method="post" id="form1" action="<cfoutput>#Request.KT_escapeAttribute(Request.KT_getFullUri())#</cfoutput>">
  <table cellpadding="2" cellspacing="0" class="KT_tngtable">
      <td class="KT_th"><label for="company_name">Company_name:</label></td>
      <td><input type="text" name="company_name" id="company_name" value="<cfoutput>#Request.KT_escapeAttribute(rsnari_company.company_name)#</cfoutput>" size="32" />
          <cfoutput>#tNGs.displayFieldHint("company_name")#</cfoutput> <cfoutput>#tNGs.displayFieldError("nari_company", "company_name")#</cfoutput> </td>
      <td class="KT_th"><label for="licensed_1">Licensed:</label></td>
        <input <cfoutput>#Iif(Request.KT_escapeAttribute(rsnari_company.licensed) EQ "y",DE("CHECKED"),DE(""))#</cfoutput> type="radio" name="licensed" id="licensed_1" value="y" />
        <label for="licensed_1">Licensed</label>
            <input <cfoutput>#Iif(Request.KT_escapeAttribute(rsnari_company.licensed) EQ "y",DE("CHECKED"),DE(""))#</cfoutput> type="radio" name="licensed" id="licensed_2" value="y" />
            <label for="licensed_2">Exempt < $2500</label>
            <input <cfoutput>#Iif(Request.KT_escapeAttribute(rsnari_company.licensed) EQ "y",DE("CHECKED"),DE(""))#</cfoutput> type="radio" name="licensed" id="licensed_3" value="y" />
            <label for="licensed_3">Exempt Specialty</label>
            <input <cfoutput>#Iif(Request.KT_escapeAttribute(rsnari_company.licensed) EQ "y",DE("CHECKED"),DE(""))#</cfoutput> type="radio" name="licensed" id="licensed_4" value="y" />
            <label for="licensed_4">Exempt Repair</label>
            <input <cfoutput>#Iif(Request.KT_escapeAttribute(rsnari_company.licensed) EQ "n",DE("CHECKED"),DE(""))#</cfoutput> type="radio" name="licensed" id="licensed_5" value="n" />
            <label for="licensed_5">Not a Contractor</label>
        <cfoutput>#tNGs.displayFieldError("nari_company", "licensed")#</cfoutput> </td>
    <tr class="KT_buttons">
      <td colspan="2"><input type="submit" name="KT_Insert1" id="KT_Insert1" value="Insert record" /></td>
  <input type="hidden" name="membertype" id="membertype" value="<cfoutput>#Request.KT_escapeAttribute(rsnari_company.membertype)#</cfoutput>" />

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

adding an onClick event to each of your radio inputs should do the trick:

for the "y" ones add:

for the "n" one change 'Contractor' to 'Associate' in the line above.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
edfmAuthor Commented:
Indeed, this does work. Thank you for your help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development Software

From novice to tech pro — start learning today.