Welcome Guest, Not a member yet? Register   Sign In
Sample code in Form Validation tutorial doesn't work
#1

[eluser]shark72[/eluser]
Pretty new to CI 2.0.1; otherwise everything is working fine.

Wanted to add form validation to my project, so I used the code here:

http://ellislab.com/codeigniter/user-gui...ation.html

Things break down after I use the code in the "Setting Validation Rules" section. Even though I've added the validation rules (copying the code verbatim), the form still returns to a blank form even when I populate the fields.

I'm using the exact file names as instructed by the tutorial, and I've copied/pasted the code verbatim.

Maybe that's my problem -- are there any placeholders in the code snippets that I must modify? I'm wondering about this one:

Code:
$this->load->helper(array('form', 'url'));

I thought perhaps 'url' should be replaced with something, but no matter what I try, it makes the entire thing barf, so I'm guessing that it really does take 'url' verbatim.

Thanks in advance for any advice...
#2

[eluser]InsiteFX[/eluser]
Read This, specifically the for_open
CodeIgniter User Guide - Form Helper

InsiteFX
#3

[eluser]shark72[/eluser]
Thanks. I confirmed that the sample code is calling form_open correctly and that the form opening HTML is present in the output. To be clear, I'm not writing my own code, but pasting in the samples and using the same filenames. There is no custom code that I'm adding and this is a fresh installation of CI that's otherwise working great.

As a test, I continued with the project in the tutorial, up to the use of custom error checking callbacks, and the demo as presented still does not operate. I will add this to the bug tracker.
#4

[eluser]shark72[/eluser]
This problem is resolved. It was caused, by all things, by my base_url not having a trailing slash in config.php.
#5

[eluser]haileCI[/eluser]
[quote author="shark72" date="1301283664"]This problem is resolved. It was caused, by all things, by my base_url not having a trailing slash in config.php.[/quote]

i have made same mistake




Theme © iAndrew 2016 - Forum software by © MyBB