⚠ In case you've missed it we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This forum is read-only and soon will be archived. ⚠


Paulo Coelho Alves

Member Since 26 Feb 2013
Offline Last Active Mar 05 2013 01:32 PM
-----

Topics I've Started

Validation for set_relation_n_n field.

26 February 2013 - 12:59 PM

Hello!

 

I have the following section in my db.

 

Screen%20Shot%202013-02-26%20at%2012.49.

 

I'm using set_relation_n_n to allow the content manager to select questions for the quiz. Fairly straightforward.

 

But in my case, quizzes should have 7 questions — no more, no less. Is there any way to set this validation?

 

Here's how I'm setting the relation:

$form1->set_relation_n_n('Questions', 'quiz_has_questions', 'quiz_questions', 'quiz_id', 'question_id', 'text', 'quiz_order'); 

 

I tried setting a rule like this, but it's not doing anything. Should it? If not, is there any workaround?

$form1->set_rules('Questions', 'Questions', 'callback_questions_check');