Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default Updating a textarea

    How do I update a textarea on my form ? I have <input type="text"
    name="fieldname"> fields and <textarea name=textarea_fieldname> fields. Afte
    the form is displayed and I make my changes on the screen, I submit the form
    and go to the action page to peform an update to the db. The sql update is set
    fieldname = '#form.fieldname#', etc. How do I update the textarea ? It will
    not accept form.texarea_fieldname.

    trojnfn Guest

  2. Similar Questions and Discussions

    1. Updating Updating site map or archive dynamically
      Hi there! ;-) Posted in Site Design as well.... Anyone know if there is a way to use Contribute to automatically/dynamically update a site map...
    2. TextArea
      I am making a simple blog, and was wondering if anyone had any suggestions on making a wysiwyg editor. I want to try and make it as much cross...
    3. Updating AI Files causes position to 'bounce' when updating in Quark
      Is there any way to build Illustrator files so that no matter what edit you might come back and make to the AI file, when you update the modified...
    4. Removing carriage returns from <textarea></textarea> input
      Hiya, I have a form with a <textarea></textarea> to receive user input. This input is then stored in a database and sent by fax... I need to...
    5. <textarea> bug????
      Simple vbscript,html page loading into access. Input pg posting to Confirm pg, then sending to access. when using; <textarea name="name"...
  3. #2

    Default Re: Updating a textarea

    What is the actual error message?
    In your post, the names don't match. Is that the case in your real code also?

    form field = tex ==> t <== area_fieldname
    won't accept = form.tex ==> <== area_fieldname

    Originally posted by: trojnfn
    How do I update a textarea on my form ? I have <input type="text"
    name="fieldname"> fields and <textarea name=textarea_fieldname> fields. Afte
    the form is displayed and I make my changes on the screen, I submit the form
    and go to the action page to peform an update to the db. The sql update is set
    fieldname = '#form.fieldname#', etc. How do I update the textarea ? It will
    not accept form.texarea_fieldname.



    Dan Bracuk Guest

  4. #3

    Default Re: Updating a textarea

    The actual error message is FORM.TEXTAREA_FIELDNAME does not exist. It does not
    allow form for textarea but does allow form for regular <input> or <cfinput>.
    Again, I have a form that I want to update. It is layed out like this :

    <form action="form_action.cfm" name="form" type="post">
    <cfinput type="text" name="field_1" value="#field_1#">
    <cfinput type='text" name="field_2" value='#field_2#'>
    <textarea name="textarea_field" rows=4 cols=100>#textarea_field#</textarea>
    <input type="submit" value="submit">
    </cfform>

    Once all of the data is displayed, I make my changes and submit the form.

    The action page does a sql update :

    <cfquery="query" datasource="datasouce_name">
    ===
    set field_1 = '#form.field_1#"'
    field_2="#form.field_2#'
    textarea_field = #form.textarea_field#

    I can update field_1 and 2 in the database with values from form.field_1 and
    2. But I cannot seem to update the textarea field because it does not like
    form.textarea_field. If I make the textarea into a input type=text field, it
    will cause the screen to scroll forever becaue of the columns, but at least it
    does update. Again, how do I update a textarea using sql update ?

    trojnfn Guest

  5. #4

    Default Re: Updating a textarea

    This is indeed odd. What happens if you do a cfdump var="#form#" at the very
    start of your page?

    Originally posted by: trojnfn
    The actual error message is FORM.TEXTAREA_FIELDNAME does not exist. It does
    not allow form for textarea but does allow form for regular <input> or
    <cfinput>. Again, I have a form that I want to update. It is layed out like
    this :

    <form action="form_action.cfm" name="form" type="post">
    <cfinput type="text" name="field_1" value="#field_1#">
    <cfinput type='text" name="field_2" value='#field_2#'>
    <textarea name="textarea_field" rows=4 cols=100>#textarea_field#</textarea>
    <input type="submit" value="submit">
    </cfform>

    Once all of the data is displayed, I make my changes and submit the form.

    The action page does a sql update :

    <cfquery="query" datasource="datasouce_name">
    ===
    set field_1 = '#form.field_1#"'
    field_2="#form.field_2#'
    textarea_field = #form.textarea_field#

    I can update field_1 and 2 in the database with values from form.field_1 and
    2. But I cannot seem to update the textarea field because it does not like
    form.textarea_field. If I make the textarea into a input type=text field, it
    will cause the screen to scroll forever becaue of the columns, but at least it
    does update. Again, how do I update a textarea using sql update ?



    Dan Bracuk Guest

  6. #5

    Default Re: Updating a textarea

    If that form is cut/pasted from your actual code, it looks like you're mixing
    up single and double quotes...

    <form action="form_action.cfm" name="form" type="post">
    <cfinput type="text" name="field_1" value="#field_1#">
    <cfinput type='text" name="field_2" value='#field_2#'> <!-- note single quote
    before text, double quote to close it -->
    <textarea name="textarea_field" rows=4 cols=100>#textarea_field#</textarea>
    <input type="submit" value="submit">
    </cfform>

    Not sure if that's enough to throw it off, but it's best to have good, clean
    code regardless.

    Also, in your query, you need to surround #form.textarea_field# with single
    quotes.

    Kronin555 Guest

  7. #6

    Default Re: Updating a textarea

    My code in the post is just a sample, so ignore the typos. Below is my actual
    code that I use to update :

    <cfset session.requestor_name = '#form.requestor_name#'>
    <cfset session.location = '#form.location#'>
    <cfset session.building = '#form.building#'>
    <cfset session.room_number = '#form.room_number#'>
    <cfset session.mail_station = '#form.mail_station#'>
    <cfset session.phone_no = '#form.phone_no#'>
    <cfset session.pickup_date = '#form.pickup_date#'>
    <cfset session.pickup_time = '#form.pickup_time#'>
    <cfset session.pickup_address_1 = '#form.pickup_address_1#'>
    <cfset session.pickup_address_2 = '#form.pickup_address_2#'>
    <cfset session.pickup_city = '#form.pickup_city#'>
    <cfset session.dropoff_address_1 = '#form.dropoff_address_1#'>
    <cfset session.dropoff_address_2 = '#form.dropoff_address_2#'>
    <cfset session.dropoff_city = '#form.dropoff_city#'>
    <cfset session.no_of_passengers = '#form.no_of_passengers#'>
    <cfset session.type_of_vehicle = '#form.type_of_vehicle#'>
    <cfset session.contact_name = '#form.contact_name#'>
    <cfset session.contact_phone = '#form.contact_phone#'>
    <cfset session.contact_cost_center = '#form.contact_cost_center#'>
    <cfset session.comments = '#form.comments#'>

    <cfif form.submit_button is "Update">
    <cfquery datasource="Charter_Services_db">
    update tblCharter_Services
    set requestor_name = '#session.requestor_name#',
    location = '#session.location#',
    building = '#session.building#',
    room_number = '#session.room_number#',
    mail_station = '#session.mail_station#',
    phone_no = '#session.phone_no#',
    pickup_date = '#session.pickup_date#',
    pickup_time = '#session.pickup_time#',
    pickup_address_1 = '#session.pickup_address_1#',
    pickup_address_2 = '#session.pickup_address_2#',
    pickup_city = '#session.pickup_city#',
    dropoff_address_1 = '#session.dropoff_address_1#',
    dropoff_address_2 = '#session.dropoff_address_2#',
    dropoff_city = '#session.dropoff_city#',
    no_of_passengers = '#session.no_of_passengers#',
    type_of_vehicle = '#session.type_of_vehicle#',
    contact_name = '#session.contact_name#',
    contact_phone = '#session.contact_phone#',
    contact_cost_center = '#session.contact_cost_center#',
    comments = '#session.comments#'
    where service_req_no = '#session.service_req_no#';
    </cfquery>

    The field name comments is my textarea and that is where I am having problems.
    I am able to make the changes on the screen but the changes will not update the
    database, the original data is still there.

    trojnfn Guest

  8. #7

    Default Re: Updating a textarea

    And in your debug information, FORM.comments is being submitted? and has the
    information you expect?

    What if you dump SESSION.comments right before the cfquery update call? is it
    what you expect?

    Why are you storing the FORM variables in SESSION variables?

    Kronin555 Guest

  9. #8

    Default Re: Updating a textarea

    Is session.service_req_no defined in your database as a numeric value? If so,
    you need to remove the single quotes around the variable in your WHERE clause.
    Also, does the database you're using accept a semi-colon at the end of an SQL
    statement?

    I also think you would learn something if you place <CFDUMP VAR=#session#>
    just before you do your update.


    jdeline Guest

  10. #9

    Default Re: Updating a textarea

    I put <cfdump> before the update and get this error :

    ColdFusion cannot determine how to process the tag <CFDUMP>. The tag name may
    be misspelled.

    If you are using tags whose names begin with CF but are not ColdFusion tags
    you should contact Allaire Support.


    The error occurred while processing an element with a general identifier of
    (CFDUMP), occupying document position (36:1) to (36:31).

    Is <cfdump> only on MX ? I cannot find it in the book and I am not running MX
    on this servier (our other one has MX).

    trojnfn Guest

  11. #10

    Default Re: Updating a textarea

    <cfdump> starts with version 5. What version are you running>

    Originally posted by: trojnfn
    I put <cfdump> before the update and get this error :

    ColdFusion cannot determine how to process the tag <CFDUMP>. The tag name may
    be misspelled.

    If you are using tags whose names begin with CF but are not ColdFusion tags
    you should contact Allaire Support.


    The error occurred while processing an element with a general identifier of
    (CFDUMP), occupying document position (36:1) to (36:31).

    Is <cfdump> only on MX ? I cannot find it in the book and I am not running MX
    on this servier (our other one has MX).



    Dan Bracuk Guest

  12. #11

    Default Re: Updating a textarea

    You have to tell CF what to dump. <CFDUMP> by itself won't do the job. Do <CFDUMP VAR=#session#> as I posted previously.
    jdeline Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139