View Issue Details

IDProjectCategoryView StatusLast Update
0038862pas2jsrtlpublic2021-05-07 05:57
ReporterYuri Serebrennikov Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Summary0038862: Can not set "for" attribute for label element.
Descriptioni try create radio button element, but cannot set attribute 'for' for label element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio

small example below
Steps To Reproduceprogram project1;

{$mode objfpc}

uses
  JS, Classes, SysUtils, Web;

var
  fMain: TJSHTMLElement;
  fElement: TJSHTMLElement;
  fInput: TJSHTMLInputElement;
  fLabel: TJSHTMLLabelElement;
begin
  fMain := TJSHTMLElement(document.firstElementChild);

  fElement := TJSHTMLElement(document.createElement('div'));
  fInput := TJSHTMLInputElement(document.createElement('input'));
  fLabel := TJSHTMLLabelElement(document.createElement('label'));

  fInput._type:= 'radio';
  finput.id := 'rb1';
  flabel.textContent:='Radio Button';
  flabel.For_:= 'rb1'; // < -- not set 'for' attribute :(

  fElement.append(fInput);
  fElement.append(fLabel);
  fMain.appendChild(fElement);
end.
TagsNo tags attached.
Fixed in Revision1181
Attached Files

Activities

Michael Van Canneyt

2021-05-07 05:57

administrator   ~0130779

Fixed. The native attribute name was 'htmlFor', not 'for'

Issue History

Date Modified Username Field Change
2021-05-06 17:16 Yuri Serebrennikov New Issue
2021-05-06 20:04 Mattias Gaertner Assigned To => Mattias Gaertner
2021-05-06 20:04 Mattias Gaertner Status new => assigned
2021-05-07 05:57 Michael Van Canneyt Assigned To Mattias Gaertner => Michael Van Canneyt
2021-05-07 05:57 Michael Van Canneyt Status assigned => resolved
2021-05-07 05:57 Michael Van Canneyt Resolution open => fixed
2021-05-07 05:57 Michael Van Canneyt Fixed in Revision => 1181
2021-05-07 05:57 Michael Van Canneyt Note Added: 0130779