11
satrebil
Re: XOOPS 2.5.0 Bug Hunting
  • 2011/3/2 13:42

  • satrebil

  • Just popping in

  • Posts: 15

  • Since: 2009/5/3 2


formcheckbox.php validation not working in XOOPS 2.5.0

Required field validation works well when there is more of a checkbox available to select, but when there is only one available checkbox validation does not work.
This error also results if more fields to further validate the checkbox, validation is not performed, since the javascript checkbox is not correct.

Reported in this post

Reported in tracker

Satrebil
(Excuse me for my english)



12
satrebil
formcheckbox.php validation not working in XOOPS 2.5.0
  • 2011/3/2 9:37

  • satrebil

  • Just popping in

  • Posts: 15

  • Since: 2009/5/3 2


Required field validation works well when there is more of a checkbox available to select, but when there is only one available checkbox validation does not work.
This error also results if more fields to further validate the checkbox, validation is not performed, since the javascript checkbox is not correct.

To solve the problem in checkbox validation with a single option, you must modify the file formcheckbox.php located in the / root / class / xoopsform directory.

We must replace the line 241 (in the XOOPS version 2.5.0) that contains:
return NWLINE "var hasChecked = false; var checkBox = myform.elements['{$eltname}'];" "for ( var i = 0; i < checkBox.length; i++ ) { if (checkBox[i].checked == true) { hasChecked = true; break; } }" "if (!hasChecked) { window.alert("{$eltmsg}"); checkBox[0].focus(); return false; }";

by
return NWLINE "var hasChecked = false; var checkBox = myform.elements['{$eltname}']; if (checkBox.length) {for (var i = 0; i < checkBox.length; i++) {if (checkBox[i].checked == true) {hasChecked = true; break;}}}else{if (checkBox.checked == true) {hasChecked = true;}}if (!hasChecked) {window.alert("{$eltmsg}");if (checkBox.length) {checkBox[0].focus();}else{checkBox.focus();}return false;}";


This is because if there is only one option the element is not an array.
We must first check if the length is not null to determinate if there is only one or more options in the checkbox.

Reported in tracker

Satrebil
(Excuse me for my english)



13
satrebil
Re: formselect.php validation not working - ALL Xoops versions
  • 2011/3/1 14:56

  • satrebil

  • Just popping in

  • Posts: 15

  • Since: 2009/5/3 2


Hello,

To solve the problem in checkbox validation with a single option, you must modify the file formcheckbox.php located in the / root / class / xoopsform directory.

We must replace the line 241 (in the XOOPS version 2.5.0) that contains:
return NWLINE "var hasChecked = false; var checkBox = myform.elements['{$eltname}'];" "for ( var i = 0; i < checkBox.length; i++ ) { if (checkBox[i].checked == true) { hasChecked = true; break; } }" "if (!hasChecked) { window.alert("{$eltmsg}"); checkBox[0].focus(); return false; }";

by
return NWLINE "var hasChecked = false; var checkBox = myform.elements['{$eltname}']; if (checkBox.length) {for (var i = 0; i < checkBox.length; i++) {if (checkBox[i].checked == true) {hasChecked = true; break;}}}else{if (checkBox.checked == true) {hasChecked = true;}}if (!hasChecked) {window.alert("{$eltmsg}");if (checkBox.length) {checkBox[0].focus();}else{checkBox.focus();}return false;}";


This is because if there is only one option the element is not an array.
We must first check if the length is not null to determinate if there is only one or more options in the checkbox.

Satrebil
(Excuse me for my english)




14
satrebil
Re: Problem using the decorator MODULE in mymenus 1.1
  • 2011/2/4 14:23

  • satrebil

  • Just popping in

  • Posts: 15

  • Since: 2009/5/3 2


Hello Trabis,

I added the code you suggested in the previous post, and now the decorator MODULE works fine.

Thank you very much.

Mymenus is a great module.

Best regards

Carlos



15
satrebil
Problem using the decorator MODULE in mymenus 1.1
  • 2011/2/4 9:30

  • satrebil

  • Just popping in

  • Posts: 15

  • Since: 2009/5/3 2


Hello,

I have installed the module mymenus in XOOPS 2.45. and XOOPS 2.5 and in both I have the same problem.

I managed to place the block to show on the theme menu, but using the decorator {MODULE|NEWS} gives errors and does not load the language files so it assumes the name of the variable.

The errors given are of the type:
Quote:
Warning: Use of undefined constant _MI_NEWS_NAME - assumed '_MI_NEWS_NAME'
in file /modules/news/xoops_version.php


and drop-down menu instead of displaying the options menu displays the name of the variable.

For example in the News-down menu appears:
Quote:
_MI_NEWS_SMNAME2
_MI_NEWS_SMNAME1
_MI_NEWS_TOPICS_DIRECTORY


I tried to see where the error occurs but I have not found.

Thanks in advance
Carlos

PD: Sorry for my bad English




TopTop
« 1 (2)



Login

Who's Online

194 user(s) are online (114 user(s) are browsing Support Forums)


Members: 0


Guests: 194


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits