EasyUI
Home
Demo
Tutorial
Documentation
Download
Extension
Contact
Forum
EasyUI Forum
March 28, 2024, 11:15:27 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
EasyUI Forum
>
General Category
>
EasyUI for jQuery
>
Obtain Data from a Form
Pages: [
1
]
« previous
next »
Print
Author
Topic: Obtain Data from a Form (Read 5197 times)
stephenl
Newbie
Posts: 30
Obtain Data from a Form
«
on:
July 01, 2018, 01:47:49 AM »
Hello
I have a datagrrid, which opens a form for user entery
This form has a button which i would like to use to run a piece of javascript, to select data based upon the data from a number of the form fields.
How would I get the data from the form fields ?
I have tried document.getElementById("Field Name") how this doesn't seem to work ?
Suggestions would be appreciated
Thank you
Logged
jarry
Administrator
Hero Member
Posts: 2260
Re: Obtain Data from a Form
«
Reply #1 on:
July 01, 2018, 04:09:01 AM »
Call the native 'serializeArray' method to get the form's data.
Code:
var data = $('#ff').serializeArray();
console.log(data);
Logged
stephenl
Newbie
Posts: 30
Re: Obtain Data from a Form
«
Reply #2 on:
July 01, 2018, 04:55:05 AM »
Exactly what i was looking for - Thanks !
Logged
stephenl
Newbie
Posts: 30
Re: Obtain Data from a Form
«
Reply #3 on:
July 01, 2018, 05:30:17 AM »
Next problem - How do I update a field value, on the form from Java
Logged
jarry
Administrator
Hero Member
Posts: 2260
Re: Obtain Data from a Form
«
Reply #4 on:
July 01, 2018, 11:31:32 PM »
Please try this code:
Code:
var data = $('#ff').serializeArray();
$.extend(data, {
yourfield: 'new value'
});
$('#ff').form('load', data)
Logged
stephenl
Newbie
Posts: 30
Re: Obtain Data from a Form
«
Reply #5 on:
July 02, 2018, 12:30:02 PM »
Great - Works as expected !
Thank You !
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> News
=> General Discussion
=> EasyUI for jQuery
=> EasyUI for Angular
=> EasyUI for Vue
=> EasyUI for React
=> Bug Report
Loading...