0

In order to create dynamically a form, Im doing something like (inside a js function) :

member = memberInfo.values[0];

// create the sign up form
var f = document.createElement("form");
f.setAttribute('method',"post");
f.setAttribute('name',"linkedInForm");
f.setAttribute('action', "users/register");

// add fields to the form
var fName = document.createElement("input");
fName.setAttribute('type',"hidden");
f.setAttribute('name',"linkedInForm");
fName.setAttribute('value',member.firstName);

I'm adding the fields to the form

// append fields to the form
f.appendChild(fName);

And then submitting it:

document.getElementsByTagName('body')[0].appendChild(f);

f.submit();

This js form is meant to be treated by a method called: 'register' in the class 'users' ( f.setAttribute('action', "users/register");)

But All I'm getting is an error 500 Internal server error. and in CodeIgniter logs :

An Error Was Encountered. The action you have requested is not allowed.

Does someone have an idea ?

Alucard
  • 1,814
  • 1
  • 21
  • 33
  • 1
    Please see: http://stackoverflow.com/questions/10274880/codeigniter-csrf-error-on-form-submittion – hakre Jun 25 '13 at 11:15

1 Answers1

1

This error seems to be generated by Security.php , change the csrf_protection to false at config.php on config folder.

$config['csrf_protection'] = FALSE; 

you better to see the bellow link for more reference

http://ellislab.com/forums/viewthread/163976/