Jump to content

UniHTMLFrame how to access component on the Frame


MOGSY

Recommended Posts

14 hours ago, MOGSY said:

I would appreciate it if you could show how to add items to the combobox "company-list" in the attached project.

Hi,

JS Code for example:

var selEl = MainmForm.UnimHTMLFrame1.element.select('#company-list').elements[0];
if (selEl) {    
    var opt = document.createElement('option');
    opt.appendChild(document.createTextNode('New Company'));
    opt.value = 'newco1';
    selEl.appendChild(opt);
}

 

Link to comment
Share on other sites

1 hour ago, MOGSY said:

Thank you for your response, how do we pass the "newco1" from delphi to UnimHTMLFrame?

procedure TMainmForm.UnimButton1Click(Sender: TObject);
begin
  UnimHTMLFrame1.JSInterface.JSCode(
    'var selEl = '#1'.element.select("#company-list").elements[0];'+
    'if (selEl) {'+
    '    var opt = document.createElement("option");'+
    '    opt.appendChild(document.createTextNode("New Company"));'+
    '    opt.value = "newco1";'+
    '    selEl.appendChild(opt);'+
    '};'
  );
end;

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...