Jump to content
uniGUI Discussion Forums
nanfilho

Get value from an html input

Recommended Posts

Hello,

Can you please specify which edition and build of UniGUI are you using?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

If you do not use the trial version, first of all please adjust your forum email address:

 

Share this post


Link to post
Share on other sites
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

 

Share this post


Link to post
Share on other sites

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;

 

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites
8 hours ago, Fernando Duarte said:

but it did not work...

What code is in the server side?

What is your problem?

Share this post


Link to post
Share on other sites
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;

 

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

In any case, you can create a new test case and attach here, we will check

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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:

formatError.png.bc141d83445459d6fe51bfa26d967a41.png

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×