nanfilho Posted January 13, 2019 Share Posted January 13, 2019 Hello friends, I am trying to capture the value of an html input, however it always comes the previous value. I put a Unilabel and load it from a unisyntaxedit with the html. I made an example to facilitate. If anyone can help, I'm grateful. Download Link https://www.dropbox.com/s/81m8l93b1fszzkq/Bootstrap com unigui.zip?dl=0 Link to comment Share on other sites More sharing options...
Sherzod Posted January 13, 2019 Share Posted January 13, 2019 Hello, Can you please specify which edition and build of UniGUI are you using? Link to comment Share on other sites More sharing options...
nanfilho Posted January 13, 2019 Author Share Posted January 13, 2019 2 hours ago, Sherzod said: Hello, Can you please specify which edition and build of UniGUI are you using? Delphi Xe8 Unigui 1.50.0.1481 Link to comment Share on other sites More sharing options...
Sherzod Posted January 13, 2019 Share Posted January 13, 2019 If you do not use the trial version, first of all please adjust your forum email address: Link to comment Share on other sites More sharing options...
Fernando Duarte Posted January 13, 2019 Share Posted January 13, 2019 1 minute ago, Sherzod said: If you do not use the trial version, first of all please adjust your forum email address: Sorry, I entered with the wrong user, I had two registrations, but the user with a licensed email is this one. nanfilho@gmail.com Link to comment Share on other sites More sharing options...
Sherzod Posted January 13, 2019 Share Posted January 13, 2019 In your case: 1. ... <button type="button" class="btn btn-primary" onclick="ajaxRequest(MainForm.LbHTML,'button',['val='+document.getElementById('exampleInputEmail1').value])">Submit</button> ... 2. procedure TMainForm.LbHTMLAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName='button' then Begin //UniSession.AddJS('MainForm.UniEdit1.setValue(document.getElementById("exampleInputEmail1").value);'); UniEdit1.Text := Params.Values['val']; ShowMessage(UniEdit1.Text); End; end; Link to comment Share on other sites More sharing options...
Fernando Duarte Posted January 13, 2019 Share Posted January 13, 2019 Thank you, it worked perfect! in case, if I want to get more than one value, what is the correct form? I tried <button type="button" class="btn btn-primary" onclick="ajaxRequest(MainForm.LbHTML,'button',['val1='+document.getElementById('exampleInputEmail1').value, 'val2='+document.getElementById('exampleInputPassword1').value])">Submit</button> but it did not work... Link to comment Share on other sites More sharing options...
Sherzod Posted January 14, 2019 Share Posted January 14, 2019 8 hours ago, Fernando Duarte said: but it did not work... What code is in the server side? What is your problem? Link to comment Share on other sites More sharing options...
Fernando Duarte Posted January 14, 2019 Share Posted January 14, 2019 7 hours ago, Sherzod said: What code is in the server side? What is your problem? the problem is that I need to get more than one value, such as email and login password, but I could not return. procedure TMainForm.LbHTMLAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName='button' then Begin ShowMessage('Email '+ Params.Values['val1']+#13+ 'Password '+ Params.Values['val2']); End; end; Link to comment Share on other sites More sharing options...
Sherzod Posted January 14, 2019 Share Posted January 14, 2019 16 hours ago, Fernando Duarte said: in case, if I want to get more than one value, what is the correct form? I tried Your code is correct and it should work. Link to comment Share on other sites More sharing options...
Sherzod Posted January 14, 2019 Share Posted January 14, 2019 In any case, you can create a new test case and attach here, we will check Link to comment Share on other sites More sharing options...
Fernando Duarte Posted January 14, 2019 Share Posted January 14, 2019 1 hour ago, Sherzod said: Your code is correct and it should work. But when I click submit nothing happens, I do not know where the error is. I uploaded the project again, if I can check again, thank you again. https://www.dropbox.com/s/81m8l93b1fszzkq/Bootstrap com unigui.zip?dl=0 Link to comment Share on other sites More sharing options...
Sherzod Posted January 14, 2019 Share Posted January 14, 2019 1 hour ago, Fernando Duarte said: But when I click submit nothing happens, I do not know where the error is. I uploaded the project again, if I can check again, thank you again. Ok, I will check Link to comment Share on other sites More sharing options...
Sherzod Posted January 14, 2019 Share Posted January 14, 2019 2 hours ago, Fernando Duarte said: But when I click submit nothing happens, I do not know where the error is. I uploaded the project again, if I can check again, thank you again. Something you have an error with text formatting: 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now