Solved

How i can replace the .form and change a textbox to a label.

Posted on 2012-04-11
8
438 Views
Last Modified: 2012-04-12
My coldufsion form is working fine.

Questions : How i'm able to change that line in my confirmation page if I've change my textbox field to a label field...:
                <cfqueryparam value = "#form.id_number#" cfsqltype="CF_SQL_INTEGER" />,  
                <B>Member ID :</B>#Form.ID_Number#

Just to let you know that my "ID_Number" field retreive the id number from a table then the user should complete all others information fields in my forms.

On that form I'd like to change that ID_Number field so that user Can see it but they can't edit it !! I don't want a textbox... a label.


Form  hello.cfm:
--------------------------------------------
.....
 <cfform id="form1" name="form1" onSubmit="return checksubmit(this);" action="confirmation.cfm" method="POST">

<td width="35%">Member ID:</td>
              <td width="65%"><cfoutput>
                  <cfinput type="text" name="ID_Number" value="#DisplayUser.ID_Number#">
                </cfoutput>

Open in new window


---------------------------------------------------------------------------------
form confirmation.cfm
------------------------------------
.......
  <cfqueryparam value = "#form.id_number#" cfsqltype="CF_SQL_INTEGER" />,

<cfquery name="logAnnualDues" datasource="#application.datasource#" username="#application.username#" password="#application.password#">
                  INSERT INTO vol (user_id, id_number, firstname)
                VALUES (
                <cfqueryparam value = "#form.user_id#" CFSQLType = "CF_SQL_INTEGER" />,
                <cfqueryparam value = "#form.id_number#" cfsqltype="CF_SQL_INTEGER" />,
                <cfqueryparam value = "#form.firstname#" CFSQLType = "CF_SQL_VARCHAR" />
.....

<cfmail from="xxx@xxx.xxx"
            server="xxxxxxx"
            subject="Form From #firstname#"
            to="xxxx@xxxxx.xxx"
                  type="html">
          ------------------------------------------------------------<BR>
          <B>Member ID :</B>#Form.ID_Number#

So two line should be changes in the confirmation.cfm are

 <B>Member ID :</B>#Form.ID_Number#
 <cfqueryparam value = "#form.id_number#" cfsqltype="CF_SQL_INTEGER" />,

What I can do ? should i install a <CFPARAM NAME="id_number" DEFAULT=""> ?? Pls advise.
thank you.
0
Comment
Question by:LelloLello
  • 4
  • 4
8 Comments
 
LVL 52

Expert Comment

by:_agx_
Comment Utility
On that form I'd like to change that ID_Number field so that user Can see it but they can't edit it !! I don't want a textbox... a label.

Make it a hidden field, so it can't be modified. But keep the label to display it to the user.

    ie
    <cfinput type="hidden" name="ID_Number"  ....>
0
 

Author Comment

by:LelloLello
Comment Utility
okay how about the confirmation form should i do any changes... let me test it.
0
 

Author Comment

by:LelloLello
Comment Utility
table border="0" cellspacing="0" cellpadding="0" width="100%" class="qtable">
            <tr>
              <td width="35%">Member ID:</td>
              <td width="65%"><cfoutput>
                  <cfinput type="hidden" name="ID_Number" value="#DisplayUser.ID_Number#">
                </cfoutput>

Open in new window


I got that error:

Attribute set validation error in tag CFINPUT<P> The tag has an invalid attribute combination: the value of the tag switch attribute 'TYPE' which is now <b>'HIDDEN'</b> is invalid. The valid attribute values are <ul><li>TEXT<li>PASSWORD<li>CHECKBOX<li>RADIO</ul><p>The error occurred while processing an element with a general identifier of (CFINPUT), occupying document position (223:19) to (223:90).<p>The specific sequence of files included or processed is:<code><br><strong>d:\users\actca\html\members\toolkit\update_vol.cfm      </strong></code><P><P>
0
 
LVL 52

Expert Comment

by:_agx_
Comment Utility
Oh, you're using an old version of CF aren't you ie CF6? Btw, going forward, you should definitely mention that in all questions .. Because most people are going to assume you're using CF8 or higher. So we'll end up wasting your time suggesting newer code that just isn't going to work on your version. ;-)

Anyway, yours doesn't support what I suggested.  So just use a regular html input:

   <input type="hidden" name="ID_Number" value="#DisplayUser.ID_Number#">
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:LelloLello
Comment Utility
Hello Agx,

Now I can't See it :) . I'd like to see it but i don't want that user to modify that text. ?

what codes i should have?

I'll have a question about difference between cf5and cf8, pls help me.
0
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
Comment Utility
Now I can't See it :) . I'd like to see it but i don't want that user to modify that text. ?

Oh, I thought that's what the label was for ;-)  Here's what I was suggesting. Notice how you can see still the value? But it can't be modified because the form field is hidden.

              <td width="35%">Member ID:</td>
              <td width="65%">
                  <cfoutput>
                  #DisplayUser.ID_Number#
                  <input type="hidden" name="ID_Number" value="#DisplayUser.ID_Number#">
                  </cfoutput>
               </td>

If you really want to keep it as text box, you could make it read only.  

    <td width="35%">Member ID:</td>
    <td><cfoutput><input type="text" readonly="readonly" name="ID_Number" value="#DisplayUser.ID_Number#">
           </cfoutput> ....

... Keep in mind showing someone a box they can't modify is often more confusing than helpful ;-)  Personally I prefer the 1st option.
0
 

Author Comment

by:LelloLello
Comment Utility
AGX,

If my CF application is build in CF5, do you think if move to CF8 it will work... is there is any replacement for these tages in CF8. ? or i have to recode everything from scracth?
0
 
LVL 52

Expert Comment

by:_agx_
Comment Utility
is there is any replacement for these tages
You don't need one for <input>.  It's a standard HTML tag which has nothing to do with CF.  So no problems there.  As far as CF tags, it's usually the other way around. ie Later versions may add new tags, but keep support for existing tags.

    If my CF application is build in CF5, do you think if move to CF8 it will work..

It's impossible to say. Every application's different. Unfortunately CF5 is built w/C++. Everything after that runs on java. So there may be differences there. You can always install the developer version and try it out.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now