@@ -346,49 +346,6 @@ protected function initialise_question_instance(question_definition $question, $
346
346
$ question ->datasetloader = new qtype_calculated_dataset_loader ($ questiondata ->id );
347
347
}
348
348
349
- public function validate_form ($ form ) {
350
- switch ($ form ->wizardpage ) {
351
- case 'question ' :
352
- $ calculatedmessages = array ();
353
- if (empty ($ form ->name )) {
354
- $ calculatedmessages [] = get_string ('missingname ' , 'qtype_calculated ' );
355
- }
356
- if (empty ($ form ->questiontext )) {
357
- $ calculatedmessages [] = get_string ('missingquestiontext ' , 'qtype_calculated ' );
358
- }
359
- // Verify formulas.
360
- foreach ($ form ->answers as $ key => $ answer ) {
361
- if ('' === trim ($ answer )) {
362
- $ calculatedmessages [] = get_string (
363
- 'missingformula ' , 'qtype_calculated ' );
364
- }
365
- if ($ formulaerrors = qtype_calculated_find_formula_errors ($ answer )) {
366
- $ calculatedmessages [] = $ formulaerrors ;
367
- }
368
- if (! isset ($ form ->tolerance [$ key ])) {
369
- $ form ->tolerance [$ key ] = 0.0 ;
370
- }
371
- if (! is_numeric ($ form ->tolerance [$ key ])) {
372
- $ calculatedmessages [] = get_string ('xmustbenumeric ' , 'qtype_numerical ' ,
373
- get_string ('tolerance ' , 'qtype_calculated ' ));
374
- }
375
- }
376
-
377
- if (!empty ($ calculatedmessages )) {
378
- $ errorstring = "The following errors were found:<br /> " ;
379
- foreach ($ calculatedmessages as $ msg ) {
380
- $ errorstring .= $ msg . '<br /> ' ;
381
- }
382
- print_error ($ errorstring );
383
- }
384
-
385
- break ;
386
- default :
387
- return parent ::validate_form ($ form );
388
- break ;
389
- }
390
- return true ;
391
- }
392
349
public function finished_edit_wizard ($ form ) {
393
350
return isset ($ form ->savechanges );
394
351
}
0 commit comments