Link to home
Start Free TrialLog in
Avatar of LelloLello
LelloLello

asked on

I would like to display this variable on my page in coldfusion how , #DisplayUsers.new_member_type#

Please take a look on myform.jpg

I have a value retreived a value from a SQL Database via CF Querry.
 <li><label for="strBadgeName"><strong>Level Type:</strong></label><cfoutput>#DisplayUsers.new_member_type#<input type="hidden" name="MemberType" value="#DisplayUsers.new_member_type#" size="36"></cfoutput></li>

Open in new window


I would like to display this value on my page, how can i do this .  

Is there a way to display it where the radio button is assigned to this value is activated...

<input type="radio" name="intOption" id="intOptionAcademics" value="350" onClick="Calculate_Sub_Total()" class="formWidget">
<input type="radio" name="intOption" id="intOption550" value="350" onClick="Calculate_Sub_Total()" class="formWidget">


<fieldset><legend>Registration Information</legend>
	<ol class="form">
		<li><label class="order" for="intOption1095">A</label>
        <input type="radio" name="intOption" id="intOption1095" value="1180" onClick="Calculate_Sub_Total()" class="formWidget">
        <span class="details">$1180<!---$1095 ---> *</span></li>
		
        <li><label class="order" for="intOption995">B</label>
        <input type="radio" name="intOption" id="intOption995" value="1000" onClick="Calculate_Sub_Total()" class="formWidget">
        <span class="details">$1000<!---$995---> *</span></li>
        
        <li><label class="order" for="intOption660">C</label>
        <input type="radio" name="intOption" id="intOption660" value="350" onClick="Calculate_Sub_Total()" class="formWidget">
        <span class="details">$350<!---$660---></span></li>

     	<li><label class="order" for="intOptionAcademics">D</label>
        <input type="radio" name="intOption" id="intOptionAcademics" value="350" onClick="Calculate_Sub_Total()" class="formWidget">
        <span class="details">$350<!---$550---> </span></li>
   
        <li><label class="order" for="intOption550">E</label>
        <input type="radio" name="intOption" id="intOption550" value="350" onClick="Calculate_Sub_Total()" class="formWidget">
        <span class="details">$350<!---$550---> </span></li>
        
    	<li><label class="order" for="intOption1195">F</label>
        <input type="radio" name="intOption" id="intOption1195" value="1195" onClick="Calculate_Sub_Total()" class="formWidget">
        <span class="details">$1,195 *</span></li>
	

Open in new window

Thank you very much for your advice!
radiobutton-coldfusion.jpg
Avatar of dgrafx
dgrafx
Flag of United States of America image

I'm not sure what you are trying to do.
I'm guessing this:
You are looping over a query
you have radio boxes that have a value (does this value come from the query? or does it come from some other concept?)
and you want one of the boxes checked IF what ??? (I'm guessing if something about it (the value?) matches something else - what is this something else? another query value?)
so could you answer these please?

here is a quick ex that might be close to what you are doing - note that an elements id must be unique or any js you try to run on it will fail
<li><input type="radio" name="intOption" id="intOption1" value="1" onClick="Calculate_Sub_Total()" class="formWidget"
            <cfif myQuery.somevalue is 1>
            checked
            </cfif>>
<li><input type="radio" name="intOption" id="intOption2" value="2" onClick="Calculate_Sub_Total()" class="formWidget"
            <cfif myQuery.somevalue is 2>
            checked
            </cfif>>
<li><input type="radio" name="intOption" id="intOption3" value="3" onClick="Calculate_Sub_Total()" class="formWidget"
            <cfif myQuery.somevalue is 3>
            checked
            </cfif>>
Avatar of LelloLello
LelloLello

ASKER

This is my querry.

 <cfquery name="DisplayUsers" datasource="Actuaries" username="#application.username#" password="#application.password#">
&#9;SELECT * FROM users INNER JOIN
    enrollees ON enrollees.enrollee_id_number = users.id_number INNER JOIN
    meminfotest ON users.id_number = meminfotest.Enrolle_id_number
&#9;WHERE (users.user_id = #client.user_id#)
</cfquery>

There is a field in my Table 'enrollees' name of the field is new_member_type

So in my code if i display an cfouput i'm able to view the data in that field which is "FL".

So here is my question.

SINCE it's a FL level, the radio button in my code should 'CHECKED DISABLED' level A on that page.


So changes i should do to my
so my query is working very good.

I have a radio button question with 6 options.

<li><input type="radio" name="intOption" id="intOption1" value="1" onClick="Calculate_Sub_Total()" class="formWidget"
            <cfif myQuery.somevalue is 1>
            checked
            </cfif>>


I will attached the code fo your review.
due-cfm.txt
how i'm able to adjust this in my code, radio button.

<cfif myQuery.somevalue is 1>
            checked
            </cfif>>
ok - well it seems like you are saying that IF something is true then boxes are disabled.

<cfloop query="xxx">
      <cfset disabled="">      
      <cfif disabledlogic eq somethingelse>
            <cfset disabled="disabled">
      </cfif>
      <li><input type="radio" name="zzz" value="1" #disabled#>a
      <li><input type="radio" name="zzz" value="2" #disabled#>b
      <li><input type="radio" name="zzz" value="3" #disabled#>c
</cfloop>
i mean Checked

So if the user is level FL, the BOX A should be Checked and the user can't changed.
Could you please assist me, open my due-cfm.txt

on line 411,


the value is
<cfoutput> #DisplayUsers.new_member_type#</cfouput> So i'm having the result which is FL.

Now, how i'm able to apply it this change on my radio button,

<cfloop query="DisplayUsers">
      <cfset disabled="">      
      <cfif disabledlogic eq somethingelse>
            <cfset disabled="disabled">
      </cfif>
<li><label class="order" for="intOption1095">A</label>
        <input type="radio" name="intOption" id="intOption1095" value="1180" onClick="Calculate_Sub_Total()" class="formWidget">
        <span class="details">$1180 *</span></li>
            


      <li><input type="radio" name="zzz" value="3" #disabled#>c
</cfloop>
ASKER CERTIFIED SOLUTION
Avatar of dgrafx
dgrafx
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have attached a picture of my SQL Table, please open it.
SQL-Table.jpg
As per your request, i have add this to my code.

<cfloop query="DisplayUsers">
<cfset disabled="">    
<cfif DisplayUsers.new_member_type eq "FL">
            <cfset disabled="disabled">
</cfif>

<li><label class="order" for="intOption1095">A</label>
        <input type="radio" name="intOption" id="intOption1095" value="1180" onClick="Calculate_Sub_Total()" class="formWidget" #disabled#>
        <span class="details">$1180 *</span></li></cfloop>


So as a result  A  $1180 * was not checked... It should be checked :(  
any idea please.
I have tried this one and it didn't work.

        
        <cfloop query="DisplayUsers">
<cfset disabled="">     
<cfif DisplayUsers.new_member_type eq "FL">
            <cfset intoption="checked">

<li><label class="order" for="intOption1095">A</label>
        <input type="radio" name="intOption" id="intOption1095" value="1180" onClick="Calculate_Sub_Total()" class="formWidget">
        <span class="details">$1180 *</span></li>
        </cfif>
        </cfloop>

Open in new window

Maybe something like that should work, what do you think... since i have the value of type...
            <cfset intOption = "#DisplayUsers.new_member_type#">

<li><label class="order" for="intOption1095">A</label>
        <input type="radio" name="intOption" id="intOption1095" value="1180" onClick="Calculate_Sub_Total()" class="formWidget">
        <span class="details">$1180 *</span></li>