Welcome Guest, Not a member yet? Register   Sign In
Form submit using wrong path
#11

[eluser]Michael Wales[/eluser]
Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_Validation::$phoneNumber

Filename: views/register.php

Line Number: 21

The validation class is populated via the the set_fields() method - you must define a field for everything you would like to access via the validation class.
#12

[eluser]williamparry[/eluser]
I don't want the phone number validated.

It appears to me that this is very convoluted code - unless I am doing something to make it so... Also, I thought instead of manually doing the md5, that it made the password md5 on validation.

The code is also not doing my "checkEmailAddress" function after "valid_email"
#13

[eluser]tonanbarbarian[/eluser]
As Michael sort of pointed out the error you are getting in fact in your view.
I think you are probably doing something like the following in your view
Code:
$this->validation->phoneNumber
But because you do not have a validation rule for phoneNumber it is causing the error.

As for the checkEmailAddress you have not specified it correctly

Code:
$rules['emailAddress']    = "required|valid_email|callback_checkEmailAddress";
and you will then need a method in the controller call "checkEmailAddress" to be able to process it

and then to get the MD5-ed password you will need to look in
Code:
$this->validation->password
#14

[eluser]williamparry[/eluser]
Ah you are quite right.

Do I change it to $this->phoneNumber?

I neglected to add the prefix "callback_"

Thanks for all your help!
#15

[eluser]tonanbarbarian[/eluser]
If you do not have a validation rule for phoneNumber then in the view you cannot do
Code:
$this->validation->phoneNumber
or anything similar
In case you are not aware
Code:
$this->validation->phoneNumber
is used to display any validation error messages for that field.
Since you are not validating that field just do not use it at all
#16

[eluser]williamparry[/eluser]
How do you reshow the value if the page is returned (another field has an error)
#17

[eluser]tonanbarbarian[/eluser]
there is always a bit of a problem with validation because data can be coming from up to 3 places

POST, Validation or the database.

When creating a new record there will not be any POST data nor a record in the database
After the add is submitted if there is a validation error then there is data in both the Validation and POST
If you are editing a record then 2 begin with the database has the only value but after submit of the form then the database, POST and Validation may all have values

You need to decide which to use

You can create a blank validation rule for the phoneNumber field and trry getting the data from $this->validation->phoneNumber but that will only have the value that was converted from POST to the Validation object.

Generally speaking I pass both the Database record and the validation to the view and then from there decide which value to display




Theme © iAndrew 2016 - Forum software by © MyBB