• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Form validation required not firing

#11
(05-08-2018, 08:24 AM)qury Wrote:
(05-08-2018, 06:03 AM)rachidE Wrote: I've already done that,  but without success

OK!
I've taken the code you have pasted in and created a brand new installation of CI 3.1.8

In order to get this thing working i had to do 2 changes to your code:

1, in the form i've changed base_url() to site_url()
2, see the example class

PHP Code:
<?php
class Test extends CI_Controller {

 
   public function __construct() {
 
       parent::__construct();
 
       // Loading helpers and library
 
       $this->load->helper(array('form''url'));
 
       $this->load->library('form_validation');
 
   }

 
   function login_pro() {

 
       $this->form_validation->set_rules('Username''Username''required');
 
       $this->form_validation->set_rules('Password''Password''required');

 
       if ($this->form_validation->run() == FALSE) {
 
           echo 'try again';
 
       } else {
 
           echo 'welcome';
 
       }
 
   }




Now, this is working fine on linux on PHP 7.2.5

Personally i do not like the case sensitive name tags in the form, so if it would be up to me u would rename Username to username, but that is just my preference..


hello,

I did what you suggested, but it still does not work.
Reply

#12
(05-09-2018, 02:40 AM)rachidE Wrote: I did what you suggested, but it still does not work.

can you zip up and attach the controller and the form here?

Also please let me know the CI version, PHP and platform you are on.
Reply

#13
(05-09-2018, 05:42 AM)qury Wrote:
(05-09-2018, 02:40 AM)rachidE Wrote: I did what you suggested, but it still does not work.

can you zip up and attach the controller and the form here?

Also please let me know the CI version, PHP and platform you are on.

in attach the zip of my files.

the vesion of my CI is : 3.1.6
the version of PHP is : 5.6.28

and i'm using XAMP on windows 7.


Attached Files
.zip   CI_validation.zip (Size: 2.47 KB / Downloads: 31)
Reply

#14
Hi,
I've fixed this up for you.

The files are in a directory structure, so you should be able to copy them to their correct place.

whaterwherisyour.domain/index.php/login_controller/index will display the login form

Take a look at the index method in Login_controller.php so next time you will not use includes in your form Smile

Also if you change the "name" tags in your form to lowercase , you have will have to do that in the form validation as well.


Attached Files Thumbnail(s)
   

.zip   CI_validation.zip (Size: 3.53 KB / Downloads: 32)
Reply

#15
(05-09-2018, 12:01 PM)qury Wrote: Hi,
I've fixed this up for you.

The files are in a directory structure, so you should be able to copy them to their correct place.

whaterwherisyour.domain/index.php/login_controller/index will display the login form

Take a look at the index method in Login_controller.php so next time you will not use includes in your form Smile

Also if you change the "name" tags in your form to lowercase , you have will have to do that in the form validation as well.

I did what you suggested, the problem presists, and in addition when I removed the header and the footer of my login page, the graphic presentation has disappeared.

have you tested this at your level ?
Reply

#16
(05-10-2018, 06:09 AM)rachidE Wrote: have you tested this at your level ?

have you read my previous reply?
I have even attached the fixed controller + view in the zip file and the screenshot of the login screen.

Have you tried those files?
Reply

#17
(05-10-2018, 06:22 AM)qury Wrote:
(05-10-2018, 06:09 AM)rachidE Wrote: have you tested this at your level ?

have you read my previous reply?
I have even attached the fixed controller + view in the zip file and the screenshot of the login screen.

Have you tried those files?

yes I saw your answer, and I applied exactly what you asked me, even for the url.
Reply

#18
(05-10-2018, 06:57 AM)rachidE Wrote:
(05-10-2018, 06:22 AM)qury Wrote:
(05-10-2018, 06:09 AM)rachidE Wrote: have you tested this at your level ?

have you read my previous reply?
I have even attached the fixed controller + view in the zip file and the screenshot of the login screen.

Have you tried those files?

yes I saw your answer, and I applied exactly what you asked me, even for the url.

and this is the entire application (view attachment)


Attached Files
.zip   CodeIgniter.zip (Size: 230.22 KB / Downloads: 29)
Reply

#19
- you load session, but the session save path is set to NULL.
- your file names are all over the place, the controller file should begin with a capital letter (Login_controller.php instead of login_controller.php)
- in application/config/config.php set the following   $config['index_page]='index.php';  (currently this is blank, but maybe you have a redirect)

I recommend reading the style guide section of the guide. Also maybe a using a linux platform for development Smile


Attached Files Thumbnail(s)
   
Reply

#20
(05-10-2018, 12:58 PM)qury Wrote: - you load session, but the session save path is set to NULL.
- your file names are all over the place, the controller file should begin with a capital letter (Login_controller.php instead of login_controller.php)
- in application/config/config.php set the following   $config['index_page]='index.php';  (currently this is blank, but maybe you have a redirect)

I recommend reading the style guide section of the guide. Also maybe a using a linux platform for development Smile

I did everything you asked me but it still does not work.

thank you.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.