This example describes the method that JS implements to receive form values and to spell the values behind the form action. Share to everyone for your reference, specific as follows:
Today encountered a problem, in the form form there are several input, which has a upload file input, now need to click on the Submit button, will not file type of input is worth and spelled &name=value format added to the action behind, So we can get it out together.
<form id= "MyForm" name= "MyForm" "method=" Post "action=" Http://www.yoursiteweb.com:8080/justsy/Dolet?type=ws_ Justsy_webclips_policy_update "Enctype=" Multipart/form-data > <!--background generates JSON--> <script type= "text/ JavaScript > var data = [{label: "Basic Information", type: "title", Tag: "H1"}, {label: "Name", type: "Input", Input: "text", Optional: False,name: "PolicyName", ID: "PolicyName", Value: ""}, {label: "Description", type: "Input", Input: "text", Optional: False,name: "PolicyDescription", ID: "PolicyDescription", Value: ""}, {label: "", type: "title", Tag: "H1"}, {label: "label (Required) ", type:" Input ", Input:" Text ", Optional:true, Name:" Label ", ID:" Label ", Value:" "}, {Label:" URL (Required) ", Type: "Input", Input: "Text", Optional:true, Name: "URL", id: "url", Value: ""}, {label: "Removeable", type: "Input", Input: " CheckBox ", Optional:false,name:" isremovable ", ID:" IsRemovable ", Value:" ", Accept:" image/* "}, {label:" Icon ", type:" Input ", Input:" File ", Optional:true, Name:" Picurl ", ID:" IconFile ", Value:" "}, {label:" PrecomposeD Icon ", type:" Input ", Input:" checkbox ", Optional:false,name:" precomposed ", ID:" precomposed ", Value:" "}, {label:" full Screen ", type:" Input ", Input:" checkbox ", Optional:false,name:" fullscreen ", ID:" fullscreen ", Value:" "}, {type:" hidden ", Name:" PolicyId ", ID:" PolicyId ", Value:" "}, {type:" hidden ", Name:" Payloaddescription ", ID:" Payloaddescription ", Value: ""}, {type: "hidden", Name: "Payloaddisplayname", ID: "Payloaddisplayname", Value: ""}, {type: "hidden", Name: " Payloadidentifier ", ID:" Payloadidentifier ", Value:" "}, {type:" hidden ", Name:" Payloadorganization ", ID:" Payloadorganization ", Value:"}, {type: "hidden", Name: "Payloadtype", ID: "Payloadtype", Value: ""}, {type: "hidden", Name: "Payloaduuid", ID: "Payloaduuid", Value: ""}, {type: "hidden", Name: "Payloadversion", ID: "Payloadversion", Value: ""
//{type: "Hidden", Name: "icon", ID: "Icon", Value: ""}, {type: "Submit", Optional:true,func: ""}]; Inputs (data)//Call this method at the place where you want to display the input box </script> <div class= "Btn-bar" > <input type= "button" onclick= " SubmitForm () "Value"= "Save" > </div> </form>
So that we can spell the past .... It's very useful .... You can also check the values in the checkbox ... Checked to 1, not selected to 0
I hope this article will help you with JavaScript programming.