I have a simple html page generated by a servlet on websphere .
<!DOCTYPE html>
<html>
<head>
<title>Server Management</title>
<meta http-equiv='refresh' content='3;URL="console"' />
<script>
function setVal(command, i){
var elmnt = document.getElementById('myvalue')
elmnt.value = command + '-' + i;
}
</script>
</head>
<body>
<form action='console'>
<button type='submit' onclick='setVal("stop", this.value)' name='stop' value='0'>Stop</button>
<button type='submit' onclick='setVal("start", this.value)' name='start' value='0'>Start</button>
<button type='submit' onclick='setVal("status", this.value)' name='status' value='0'>Status</button>
<div style='display:inline'>Server 3 is <div style='display:inline;color:green'>UP</div> </div>
<br/>
<input type='hidden' name='myvalue' id='myvalue' value='bla'/>
</form>
</body>
</html>
The thing is, when I call localhost(or 127.0.0.1) to upload the page everithing works as expected, and the right values are sent
http://localhost:9081/MyApp/MyAction?status=0&myvalue=status-0
BUT when I use the hostname (or IP) instead of localhost the element's innerHTML is sent rather then it's value, which of course cause errors.
http://myhostname:9081/MyApp/MyAction?status=Status&myvalue=status-Status
What should I do?
It's all about the IE version... Turning on competability mode fixed the issue.
A better solution is adding
<meta http-equiv="X-UA-Compatible" content="IE=8" />
to the HTML.
Thank you Microsoft for the great apps you give us
Related
local index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
<form action="/sign" method="POST">
<input v-model="zip" id="zip" type="text">
<input type="submit" value="Submit">
</form>
{{ zip }}
</div>
<script>
const App = new Vue({
el: '#app',
data: {
zip: ''
},
})
</script>
</body>
</html>
We open this in chrome. After entering something in the input box, we can see in the chrome console that v-model is correct:
App.zip and document.querySelector('#zip').value are the same.
If we then navigate to a new site (www.google.com, etc.), and then hit back on the browser to go back to the index.html file,
App.zip = ''
and
document.querySelector('#zip').value is = to what we put in before.
Is this documented and expected? Can we make it so that App.zip tracks this correctly?
Thanks.
That's back-forward cache (at least the implementation on Chrome).
In a real scenario bfcache is disabled because the app is either on https or because it's not cached (header Cache-Control: no-cache, max-age=0, must-revalidate, no-store)
I could not comment, I wrote as an answer because my score was not enough. I think you should take a look here. https://vuex.vuejs.org/
The functionality listed below executes properly when I submit content back to the server through google.script.run however it does not work for my coworkers in the same file. These coworkers are on the same domain and have edit access to the spreadsheet and are able to load the first portion of the feature, the rough-sketch modal, from the template I built (html shown below).
Our experiences seem to diverge when they hit the "Submit" button - their client should be calling google.script.run.userSubmissions. On the back-end executions view, however, I do not receive any indication that their client side script is properly calling the userSubmission function - shown below I would expect it to show up at the top, line item 3 is when I performed the same action and my client called google.script.run as expected. Also, I cannot seem to see any errors being reported of any kind.
Full html being presented in a floating modal window:
Note: I have 3 scriptlets printing in the function call and have verified that these are working properly in my co-workers clients
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Provide Comment</title>
</head>
<body>
<h3>Provide comment for content item #</h3>
<div>
<span>Title</span>
<p>Content</p>
</div>
<div>
<label style="display: block;" for="commentInput">Comment:</label>
<textarea
id="userComment"
style="display: block; margin: 1em 0 1em 0; width: 99%;"
name="commentInput"
rows="10"
placeholder="Please provide your comment here..."
></textarea>
<button style="float: right;" onclick="submitComment()">
Submit
</button>
</div>
<script>
function submitComment() {
let comment = document.getElementById("userComment").value;
google.script.run
.withSuccessHandler(closeModal)
.withFailureHandler(onFailure)
.userSubmission(
comment,
"comment",
parseInt(<?= contentIDColumn; ?>),
parseInt(<?= eventContentID; ?>),
parseInt(<?= statusColumn; ?>)
);
function closeModal() {
google.script.host.close();
}
function onFailure(error) {
console.log(error);
let message = "There was an error processing that form. Perhaps try again?"
document.getElementById("errorMessage").textContent = message;
}
}
</script>
</body>
</html>
I try to develop and test XPages locally as much as possible because of speed. One thing that have been bugging me for years now is that richtext fields does not work when using "Preview in webbrowser".
This is the XPage
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:inputRichText id="inputRichText1"></xp:inputRichText>
</xp:view>
The result in webbrowser is an empty screen
In developer tools it looks like this
I get the same result on two computers, I am using english version of designer, 9.0.1 FP8. It does not make a difference if lang="sv" or lang="en"
The HTML looks like this
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="sv">
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="/xsp/.ibmxspres/.mini/css/#Da&#Ib&2Tfxsp.css&2TfxspLTR.css&2TfxspSF.css.css">
<script type="text/javascript">var dojoConfig = {locale: 'sv-se', parseOnLoad: true};</script>
<script type="text/javascript" src="/xsp/.ibmxspres/dojoroot-1.8.3/dojo/dojo.js"></script>
<script type="text/javascript" src="/xsp/.ibmxspres/.mini/dojo/.sv-se/#In.js"></script>
<script type="text/javascript">dojo.require("ibm.xsp.widget.layout.xspClientDojo")</script>
<script type="text/javascript">dojo.require("dojo.parser")</script>
<script type="text/javascript">dojo.require("ibm.xsp.widget.layout.xspCKEditor")</script>
</head>
<body class="xspView tundra">
<form id="view:_id1" method="post" action="/nn.nsf/Test.xsp" class="xspForm" enctype="multipart/form-data">
<input id="view:_id1:inputRichText1_h" name="view:_id1:inputRichText1_h" type="hidden" value=""><input id="view:_id1:inputRichText1_mod" name="view:_id1:inputRichText1_mod" type="hidden" value=""><div class="domino-richtext xspInputFieldRichText"><textarea rows="1" cols="1" id="view:_id1:inputRichText1" name="view:_id1:inputRichText1" dojoType="ibm.xsp.widget.layout.xspCKEditor"></textarea></div>
<input type="hidden" name="$$viewid" id="view:_id1__VUID" value="!eudik9rn2f!">
<input type="hidden" name="$$xspsubmitid">
<input type="hidden" name="$$xspexecid">
<input type="hidden" name="$$xspsubmitvalue">
<input type="hidden" name="$$xspsubmitscroll">
<input type="hidden" name="view:_id1" value="view:_id1"></form>
<script type="text/javascript">
XSP.addOnLoad(function() {
dijit.byId("view:_id1:inputRichText1").initForEdit();
function view__id1_inputRichText1_rteSubmit(thisEvent) {
var rte=dijit.byId("view:_id1:inputRichText1");
var txta=XSP.getElementById("view:_id1:inputRichText1_h");
if(!rte || !txta) return;
txta.value = rte.getValue();
return true;
}
XSP.addQuerySubmitListener("view:_id1", view__id1_inputRichText1_rteSubmit, null, "view__id1_inputRichText1_rteSubmit");
});
</script>
</body>
</html>
How can I fix this so that the Richtext fields load correctly when preview in webbrowser
Thanks
Thomas
Almost certainly, there are some plugins not available for Designer Local Preview that are expected. ".ibmxspres" in the URL points to XPages-provided resources. Many of those since 8.5.2 were delivered via OSGi plugins. This is one of the reasons that over the last 18 months I've been working with IBM to get a developer license for the Domino server. That's available now from developerWorks and it's the easiest, quickest and best practice solution.
Based on some other code I found from this site (This Question here - Get URL and save it | Chrome Extension)
I was wondering on how to display the URL of a current page in a input box. My coding is below
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
<script>
chrome.tabs.getSelected(null, function(tab) {
document.getElementById('currentLink').innerHTML = tab.url;
});
</script>
</head>
<body>
<div class="links">
<div id="currentLink">Getting Current URL...</div>
<input type="text" id="currentLink" value="Loading...">
</div>
</body>
</html>
(I've cut some features out).
But my question is, how can I get the URL to display in the input box, it displays when I use "div id" but not when I use "input id" any ideas why?
You have to set the value attribute of inputs.
document.getElementById('currentLink').value = tab.url;
Hey So I have a project for school where I have to create a website and in the website there has to be a quiz. The questions are asking for numbers as answers, so I cannot use radio buttons. I know how to make textboxes and submit buttons but I dont think the box is getting the information, so I was wondering if someone could help me fix my code
Here is the end of what I have
*This is not the question I am asking this is just so I can get the code working
<P><INPUT TYPE=SUBMIT VALUE="Submit"> </FORM>
<SCRIPT type=text/javascript>
</FORM>function getAnswer(input) { if (input == "3.14") {alert ("Congradulations")} else {alert ("No that's incorrect, please try again...")}
}
</SCRIPT>
You surely haven't given us the complete code we need to answer your question, but here's all the wrong things I can see in your code snippet fixed.
The most obvious wrong thing was the text </FORM> placed inside your <script> tag.
I also fixed your misspelling Congradulations, because I imagine that wouldn't go down too well :)
<p><input type="submit" value="Submit" /></p>
</form>
<script type="text/javascript">
function getAnswer(input) {
if (input == "3.14") { //What is the value of Pi to 2 decimal places?
alert("Congratulations");
} else {
alert("No that's incorrect, please try again...");
}
}
</script>
If this isn't helpful, please show us more of your file.
#Olivia try this code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title><br />
</head>
<body>
<form id="form1" name="form1" method="post" action="" onsubmit="getAnswer();"
<p>
<label for="textfield"></label>
Q. What is the value of Pi to 2 decimal places?</p>
<p>Answer
<input type="text" name="textfield1" id="textfield1" />
</p>
<p>
<input type="submit" name="button" id="button" value="Submit" />
</p>
</form>
<script type="text/javascript">
function getAnswer(input) {
if (document.form1.textfield1.value == "3.14") { //What is the value of Pi to 2 decimal places?
alert("Congratulations");
} else {
alert("No that's incorrect, please try again...");
}
}
</script>
</body>
</html>
In form submit I give an action to call the function.
onsubmit="getAnswer();"
Inside the function I am getting the value as
document.form1.textfield1.value
Then simple steps.
Cheers