# |
Mar 25th 2019, 17:48 |
ricksaccous |
you can just do $this->Form->control('academic_year', [ 'options' => $arrayOfYearOptions, 'empty' => true]); or something |
# |
Mar 25th 2019, 17:47 |
ricksaccous |
you probably shouldn't use that form control |
# |
Mar 25th 2019, 17:47 |
ricksaccous |
lol |
# |
Mar 25th 2019, 17:47 |
ricksaccous |
i have a feeling you are passing the academic year as an array |
# |
Mar 25th 2019, 17:47 |
this.impetus |
kk |
# |
Mar 25th 2019, 17:47 |
ricksaccous |
debug that before you patch |
# |
Mar 25th 2019, 17:47 |
ricksaccous |
yeah, you can customize them |
# |
Mar 25th 2019, 17:47 |
ricksaccous |
debug $this->getRequest->getData(); |
# |
Mar 25th 2019, 17:47 |
this.impetus |
to be honest that makes me feel significantly better :P the error message, sadly, is also baked in |
# |
Mar 25th 2019, 17:47 |
ricksaccous |
can you |
# |
Mar 25th 2019, 17:46 |
ricksaccous |
i'm not even sure about the default way this works, lol damn |
# |
Mar 25th 2019, 17:46 |
ricksaccous |
wait |
# |
Mar 25th 2019, 17:46 |
ricksaccous |
look at the 'dirty' fields of your entity |
# |
Mar 25th 2019, 17:44 |
this.impetus |
How's that? lines 15 and 41 in the entity both refer to 'academic_year' |
# |
Mar 25th 2019, 17:44 |
ricksaccous |
it's not even in your assignment entity |
# |
Mar 25th 2019, 17:44 |
ricksaccous |
it's not being passed in |
# |
Mar 25th 2019, 17:43 |
ricksaccous |
you're date value isn't even being read |
# |
Mar 25th 2019, 17:43 |
ricksaccous |
lol |
# |
Mar 25th 2019, 17:43 |
ricksaccous |
wait a minute |
# |
Mar 25th 2019, 17:43 |
ricksaccous |
only should have to do it in validator |
# |
Mar 25th 2019, 17:42 |
this.impetus |
Hrmm. I've tried using ```['Y']``` and ```['y']``` in both the view and validator, there appears to be no effect |
# |
Mar 25th 2019, 17:42 |
ricksaccous |
https://api.cakephp.org/3.7/class-Cake.Validation.Validation.html#_date |
# |
Mar 25th 2019, 17:41 |
ricksaccous |
you should also probably give smarter error messages so you know what rule got triggered |
# |
Mar 25th 2019, 17:40 |
ricksaccous |
instead of a capital Y |
# |
Mar 25th 2019, 17:40 |
ricksaccous |
i think you just need a lowercase y |
# |
Mar 25th 2019, 17:40 |
ricksaccous |
https://api.cakephp.org/3.7/class-Cake.Validation.Validator.html#_date |
# |
Mar 25th 2019, 17:39 |
ricksaccous |
you'll see that the date validator is the one triggered |
# |
Mar 25th 2019, 17:39 |
ricksaccous |
so i think the answer is pretty simple |
# |
Mar 25th 2019, 17:37 |
this.impetus |
done; added a new file to the gist, "Debug Output" |
# |
Mar 25th 2019, 17:36 |
ricksaccous |
add the resulting debug information to the gist if you want |
# |
Mar 25th 2019, 17:36 |
this.impetus |
ah. brilliant. sec. |
# |
Mar 25th 2019, 17:35 |
ricksaccous |
and that will give more information to proceed |
# |
Mar 25th 2019, 17:35 |
ricksaccous |
you should see which validation rule triggered for the year to be invalid |
# |
Mar 25th 2019, 17:35 |
ricksaccous |
exit; |
# |
Mar 25th 2019, 17:35 |
ricksaccous |
after this line debug($assignment); |
# |
Mar 25th 2019, 17:35 |
ricksaccous |
@this.impetus https://gist.github.com/jmwmulle/497103a7510ca52cb3d7f18b578a80ea#file-controller-L64 |
# |
Mar 25th 2019, 17:32 |
this.impetus |
... I am terribly sorry; assuming you're indicating a specific means of debugging, I don't know how to do that. |
# |
Mar 25th 2019, 17:31 |
ricksaccous |
have you tried debugging the entity after patching it? |
# |
Mar 25th 2019, 17:31 |
this.impetus |
yeah, ```<?=$this->Form->control('academic_year', ['type'=>'year', 'minYear'=>1950, 'maxYear'=>date('Y')]);?>``` creates a dropdown select |
# |
Mar 25th 2019, 17:31 |
ricksaccous |
@this.impetus it might be helpful to see what error is triggering, is it the integer rule that causes it to trigger? |
# |
Mar 25th 2019, 17:30 |
ricksaccous |
eh it's prob with the type year stuff |