Ok this might be hard to explain.
Picture a single form that has multiple selects.
Each select belongs to a section_id so it can range between 1 -5 in its id
value. A Section has many Options and Options belong To Section
Each section_id has many options so to make it clear to understand
Section 1 you can select values of 0-5
Section 2 selects can select options 6 - 10
Section 3 can select say options 11 - 15
So the form has
Select1 | Select1 | Select1
Select2 | Select2 | Select2
Select3 | Select3 | Select3
Now comes validation I need to ensure that the values were not changed buy
firebug so someone tries to save a Select3 option as a value in Select2.make
sense?
So when validating select1 its only valid if it contains values 0-5. I am
currently doing a foreach thru the submitted array and checking with
foreach ( $data['UsersOption'] as $key => $value) {
//cached data sets of $section_id for each section
//so this gets all options available to choose from for the section
$valid_options = $this->Option->__getOptionList( $value['section_id'] );
if ( !in_array( $key, $valid_options ) ) {
//if not in list specific to the section remove key
unset( $data['UsersOption'][$key] );
}
}
I know its rather hard to understand but maybe someone would know if there
is a better way?
Thanks,
Dave
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en