Solved

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

Posted on 2012-04-11
8
445 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 52

Expert Comment

by:_agx_
ID: 37834236
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
ID: 37834277
okay how about the confirmation form should i do any changes... let me test it.
0
 

Author Comment

by:LelloLello
ID: 37834325
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 52

Expert Comment

by:_agx_
ID: 37834397
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
 

Author Comment

by:LelloLello
ID: 37834477
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
ID: 37834573
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
ID: 37839308
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_
ID: 37841099
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
push Book Today button to right 10 68
Coldfusion builder and IIS 2 23
javascript form - error when hitting enter 3 28
WordPress Page Content Lost 2 21
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

730 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