?
Solved

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

Posted on 2012-04-11
8
Medium Priority
?
450 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
Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

 
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 2000 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

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?
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

752 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