Hi,
I have a problem to pass the value of url in javascript. Could anyone please help me to add the urls in the js file? Not sure where should I put them on the js file. This is the html tag below:
div class="row" style="margin-bottom: 10px;"><input type="submit" value="Login" name="btnSubmit" class="submitLogin" onClick="checkRealm()" /></div>
And the requests are below:Add realm strings (Realm strings must be passed in on the login page in order to tell JuniperNetworks application which realm to direct the user to)
• Intranet - Full: realm-js-tfa-full • Intranet - Split: realm-js-tfa-split • Mission: realm-mnet-tfa • Research: realm-rn-tfa • BrowserRAS: realm-js-tfa-browser
Note: The onClick event in LoginPage.thml triggers the “checkRealm()” function to check which realm string to post. “js/jquery-custom.js” is the file that contains the realm string logic. It is outdated, so you will need to update the code to calculate which realm string to post to the JuniperNetworks application.
I am not where I am suppose to add those realm strings on js file below:
function checkRealm() { var realmString = ''; var accessString = ''; var tunnelString = ''; // check login method if(document.forms["frmLogin"].loginMethod.value !== '') { if(document.forms["frmLogin"].loginMethod.value == '0') { var realmString = "realm-jpl-password"; } else { var realmString = "realm-jpl-tfa"; } } // check access mode for VPN or Browser Only //if(document.forms["frmLogin"].accessMode.value !== '') { if(document.forms["frmLogin"].accessMode[0].checked == true) { // add conditionals here to check for full or split (for client); if(document.forms["frmLogin"].tunnelMode[0].checked == true) { var tunnelString = "-full"; } else if(document.forms["frmLogin"].tunnelMode[1].checked == true) { var tunnelString = "-split"; } } else if(document.forms["frmLogin"].accessMode[1].checked == true) { var accessString = "-browser"; } //} // add the strings together var fullRealmString = realmString.concat(accessString, tunnelString); // add the fullrealmstring to post document.getElementById("realm").value = fullRealmString; //post everything function post_to_url(path, params, method) { method = method || "post"; // Set method to post by default, if not specified. // The rest of this code assumes you are not using a library. // It can be made less wordy if you use one. var form = document.createElement("form"); form.setAttribute("method", method); form.setAttribute("action", path); for(var key in params) { if(params.hasOwnProperty(key)) { var hiddenField = document.createElement("input"); hiddenField.setAttribute("type", "hidden"); hiddenField.setAttribute("name", key); hiddenField.setAttribute("value", params[key]); form.appendChild(hiddenField); } } document.body.appendChild(form); form.submit(); } }
Any helps would be greatly appreciated!!
Beckmann