Solved

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

Posted on 2012-04-11
8
440 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_
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
 
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
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 …

910 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

24 Experts available now in Live!

Get 1:1 Help Now