Project

General

Profile

Actions

Bug #15034

closed

Radio button validation does not work if there is only one radio button

Added by old_gunthersc about 19 years ago. Updated over 18 years ago.

Status:
Closed
Priority:
Should have
Category:
Frontend
Target version:
-
Start date:
2005-10-12
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
3.6.2
PHP Version:
4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

validateForm() will not correctly validate radio buttons if there is only one radio button in a group. This is because fObj.length (t3lib/jsfunc.validateform.js line 87) is undefined in this case, and therefore the validation loop is never entered and "value" remains undefined.

This is easily fixed by changing the code as seen in the file attached.
(issue imported from #M1578)


Files

new_radio.txt (296 Bytes) new_radio.txt Administrator Admin, 2005-10-12 10:16
new_radio.patch (1.02 KB) new_radio.patch Administrator Admin, 2005-10-12 10:38
Actions #1

Updated by old_gunthersc about 19 years ago

Added an unified diff patch for the issue. The issue is also present in 3.8.0.

Actions #2

Updated by Sebastian Kurfuerst about 19 years ago

Hm, in which case do you need only one radio button? This doesn't make any sense to me, as the user cannot deselect it anymore. Isn't it better to use checkboxes instead?
Greets, Sebastian

Actions #3

Updated by old_gunthersc about 19 years ago

Hi Sebastian: this is not a case of needing only one radio button, but it happened in an automated ticketing form that creates a number of radio buttons depending dynamically on what kinds of tickets are available.

Usually there are several kinds of tickets, but we did run into this bug when there was only one kind of ticket -- and therefore only one radio button -- available.

Actions #4

Updated by Sebastian Kurfuerst about 19 years ago

Hi,
I think it is interesting that length is not 1 if there is only one radio button defined, but not defined... Is this normal JS behavior, do you know this?
Greets, Sebastian

Actions #5

Updated by old_gunthersc about 19 years ago

Apparently yes, from my tests to figure out the source of this bug. Basically, if you only have one button, it's not an array of buttons and therefore has no length.

Actions #6

Updated by Sebastian Kurfuerst almost 19 years ago

fixed in CVS.

Actions

Also available in: Atom PDF