Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8638205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:40:18+00:00 2026-06-12T10:40:18+00:00

CakePHP documentation says to avoid CSRF attacks it is necessary to include the Security

  • 0

CakePHP documentation says to avoid CSRF attacks it is necessary to include the Security component in the controller, and in addition, create the form using the FormHelper.

In my case, i need to create some form fields (such as a textarea) using JavaScript (jQuery) and therefor I can not use the FormHelper for them.

$('#body').html('<textarea name="data[post][body]" type="textarea" cols="30" rows="3">'+text+'</textarea>');

And of course, it doesn’t pass the security and the form fails to be submitted.

Is there anyway I can create a secure Form creating some fields with JavaScript?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:40:20+00:00Added an answer on June 12, 2026 at 10:40 am

    Well, one option you have is to unlock these fields so they are ignored in the security check. In your view, write:

    <?php $this->Form->unlockField('fieldname'); ?>
    

    Another option would be to create the form fields you want to add dynamically with the Form helper in a hidden area of the form and only show them if needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use the Security component in order to avoid CSRF attacks
I'm trying to create a form using Cakephp's FormHelper class. The form needs to
I am using CakePHP 1.3 to write a application, and I create a datetime
I am using cakephp 1.3. here's my problem: I have a controller named learns
I'm starting to write unit tests using the CakePHP framework and SimpleTest. The documentation
I'm using CakePHP 2.2.0 and I need to create one route that get this
Using CakePHP's form helper to generate a checkbox is easy enough; to use the
Using CakePHP 1.3 , I post a form which correctly fills in $this->data .
I'm using CakePHP for a small web app and on one form page there's
CakePHP has a requireSecure function in the SecurityComponent. I'm using this to force SSL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.