Solved

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

Posted on 2012-04-11
8
448 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
Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

 
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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
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 invoke it on a web page. 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.: (CODE)

688 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