webMethods Business Console Documentation 10.5 | webMethods Business Console Documentation | Developing Gadgets for Business Console | Getting Started | Using Forms with Gadgets | Adding JavaScript Code to Submit Form
 
Adding JavaScript Code to Submit Form
* To add the JavaScript logic to submit form
1. Get form values.
2. Construct the URL to submit form.
3. Create <head> tag under <html> tag.
4. Add the code block given below.
<head>
<script>
function submitForm(){
var firstName= document.getElementById("firstName").value;
var lastName= document.getElementById("lastName").value;
var phone= document.getElementById("phone").value;


var href ="";
if(window.location.href.indexOf("?")>0){
href = window.location.href.substring(0,
window.location.href.indexOf("?"));
}else{
href= window.location.href;
}


var actionUrl = href+"?firstName="+firstName;
actionUrl =actionUrl+"&amp;lastName="+lastName;
actionUrl +="&amp;phone="+phone;

window.location.href=actionUrl;
window.location.reload();

}
</script>
</head>

Copyright © 2014-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.