HTA back button not working - html

Back button on the below code is not working. When I click back, its not coming to previous page. Can anyone suggest how can I make it work? Thanks for your suggestions. I tried a lot to check everything possible. I didn't get this one working.
<html>
<head>
<title>Title</title>
<HTA:APPLICATION ID="Main"
APPLICATIONNAME="Main Application"
BORDER="thin"
BORDERSTYLE="normal"
CAPTION="yes"
CONTEXTMENU="no"
ICON=""
SHOWINTASKBAR="no"
SINGLEINSTANCE="yes"
SYSMENU="yes"
NAVIGABLE="yes"
MAXIMIZEBUTTON="no"
MINIMIZEBUTTON="no" />
<script language="VBScript" type="text/vbscript">
function doValidation()
dbalias=frmMyForm.test.Value
IF len(dbalias)=0 then
document.writeln("Please select the Environment and Try again")
doValidation=False
document.writeln("<br><tr><td nowrap align=Center colspan=2><input type=button value=Back name=ClickBack onclick=history.back()></td></tr>")
End if
End function
Sub cmdSubmit_OnClick
if (doValidation()) Then
dbalias=frmMyForm.test.Value
MGSBOX DBALIAS
End if
End Sub
</script>
</head>
<body bgcolor="#E6E6FA">
<h1 align="center"><font face="Times Roman" color="blue">Title</font></h1>
<form action="temp3.php" name="frmMyForm" id="frmMyForm" method="post">
<fieldset>
<label>* Select the Test </label>
<select name="test" id="test">
<option value="" selected></option>
<option value="test1">Test1</option>
<option value="test2">Test2</option>
<option value="test3">Test3</option>
</select>
<br>
<input type="button" name="cmdSubmit" id="cmdSubmit" value="Submit" style="height:25px; width:60px">
</fieldset>
</form>
</body>
</html>

According to this horse's mouth, a .HTA does not support a history. That seems plausible, as a .HTA lacks IExplorer's chrome/gui. The link provides a JScript implementation that could be ported to VBScript, although #Teemu's concerns should be dealt with first.
Update wrt Teemu's comment:
Another mouth mentioning problems with history - on IE 10. So maybe it is a version thing. Interestingly, this horse switched to IE kiosk mode; perhaps that could be another way of solving the OT's real world problem.

Related

Why do HTML dropdown selections sent in the form of an email look so unreadable

I'm working on an automated shopping list using HTML only. I've figured out a way to send the dropdown selections to an email draft. I wanted to know why the HTML dropdown selections look bad once they reach the email draft.
As you can see in the screenshot, the dropdown selections made are stored in a non-plaintext form. That is, the special characters like the +, & make it look really unreadable. How do you change that?
So instead of flour brand = Option A, or something like that, it says flour+brand=OptionA
And instead of separating flour brand and weight with a comma or a newline, it says flour+brand=OptionA&flour+weight=5kg or something like that.
How do I make the draft more readable by getting rid of unnecessary characters, etc.?
I'm really sorry, but honestly, I don't know any other way of expressing myself. I hope the screenshot helps. I'd highly appreciate an edit for this question's title and stuff.
If possible, do help out.
Code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
</head>
<body>
<h1>Automated Shopping List</h1>
<form action="mailto:recipient#gmail.com" method="post">
<label for="flour brand">Flour Brands:</label>
<select name="flour brand" id="flour">
<option value="OptionA">OptionA</option>
<option value="OptionB">OptionB</option>
<option value="OptionC">OptionC</option>
</select>
<select name="flour weight" id="flour">
<option value="1kg">1kg</option>
<option value="2kg">2kg</option>
<option value="3kg">3kg</option>
<option value="4kg">4kg</option>
<option value="5kg">5kg</option>
</select>
<br>
<label for="sugar weight">Sugar Weight:</label>
<select name="sugar weight" id="sugar">
<option value="1kg">1kg</option>
<option value="2kg">2kg</option>
<option value="3kg">3kg</option>
<option value="4kg">4kg</option>
<option value="5kg">5kg</option>
</select>
<br>
<input type="submit" value="Send Email" />
</form>
</body>
</html>
Try encoding your form as plain text:
<form action="mailto:recipient#gmail.com" method="post" enctype="text/plain">
https://www.w3schools.com/tags/att_form_enctype.asp

vbscript onload legacy code

I know this question has been answered a million times over, over 2 decades or so however, I have legacy code (by that I mean old code that has been around for decades written in classic asp) and it uses a vbscript onload function and it works fine. However when I try to replicate (cut down version) myself it does not work can somebody direct me to the official answer. My code is in the same folder as the legacy code. I have also modified the legacy code and it still works so it cannot be caching.
I tried and all give me an error:
startup
startup;
startup()
startup();
vbscript:startup()
vbscript:startup();
I tried also, but no error but no result
vbscript::startup()
vbscript::startup();
My code:
<html>
<head>
<title>TEST</title>
<script language="vbscript">
Sub startup()
f1.browser.disabled = True
End Sub
</script>
</head>
<body onLoad="vbscript::startup()">
<form name="f1">
<input list="browsers" name="browser">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
<input type="submit">
</form>
<p><b>Note:</b> The datalist tag is not supported in Safari or IE9 (and earlier).</p>
</body>
</html>
If I change it to JavaScript it does work as everyone else seems to suggest however WHY DOES MY LEGACY CODE WORK!!!
Without submitting the hole page can someone suggest something.
Recently I have solved very similar problem and found on this reliable web site:
Specifying legacy document modes
following solution: using x-ua-compatible header.
<html>
<head>
<!-- Use Internet Explorer 9 Standards mode -->
<meta http-equiv="x-ua-compatible" content="IE=9">
<title>My webpage</title>
</head>
<body>
<p>Content goes here.</p>
</body>
</html>

Simple AngularJS Script Works in Chrome but fails in IE11

I have a simple AngularJS (v1.3.0-rc.1) page (see below) from the book, Learning AngularJS for .NET Developers (Packt Publishing) page 13, that works in Chrome, but fails to pickup the <span title="{{color}}" style="background-color:{{color}};"> </span> correctly in IE11. The F12 option in IE shows the style is not being picked up, <span title="magenta"> </span>. What can the problem be in IE11?
<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="utf-8" />
<title>Chapter 1 Example - AngularJS</title>
<script src="Scripts/angular.js"></script>
</head>
<body>
<h1>Introduction</h1>
<label>My name:</label>
<input type="text" placeholder="Please enter name" ng-model="name" />
<br />
<label>My favorite color:</label>
<select ng-model="color">
<option>Please select</option>
<option>red</option>
<option>yellow</option>
<option>magenta</option>
</select>
<h3 ng-show="name">Hello! My name is {{name}}.</h3>
<h3 ng-show="color">My favorite color is <span title="{{color}}" style="background-color:{{color}};"> </span></h3>
</body>
</html>
This is probably failing because the browser is attempting to apply styles before AngularJS has gotten ahold of the string and replaced {{color}} with whatever value is being set.
Angular offers some angular-specific attributes to handle this discrepancy (ng-style, ng-href, etc).
Try replacing that span with:
<span title="{{color}}" ng-style="{'background-color':color}"> </span>
I had to use ng-attr-style.
<div ng-attr-style="width: {{value}}%"></div>
Here is a github discussion about this issue.
Here is a stackoverflow question which has more solutions.

Auto complete in HTML doesn't really work

I'm just testing with a simple log-in page. Here are 3 text-forms.
Username, EmailAddress, Password.
When I put the value in there, hit the submit,and auto-complete works for only 2 of them. And the form (EmailAddress) is not filled at all.
I just couldn't figure out why auto-complete is not working at EmailAddress.
<!DOCTYPE html>
<html>
<head>
<title>Log in Page</title>
</head>
<body>
<form action="login.php" method='post'>
<p><strong>Login Page </strong></p>
<p>Username:<input name="username" type="text" ></p>
<p>EmailAddress:<input name="email" type="text" ></p>
<p>Password:<input name="password" type="password""></p>
<p><input type="submit" name="Submit" value="Login"></p>
</form>
</body>
</html>
Try setting the autocomplete value. It should default to on, but I'd try adding it.
It's also possible your browser has already recorded the data for the autocomplete (as it seems by the image at least), which could mean the browser no longer tries to find anything. Try renaming all the fields and the form (just to test it out, of course) and see if your browser inquires you to save the form data upon submission.
<!DOCTYPE html>
<html>
<head>
<title>Log in Page</title>
</head>
<body>
<form action="login.php" method='post'>
<p><strong>Login Page </strong></p>
<p>Username:<input name="username" type="text" ></p>
<p>EmailAddress:<input name="email" type="text" autocomplete="on"></p>
<p>Password:<input name="password" type="password""></p>
<p><input type="submit" name="Submit" value="Login"></p>
</form>
</body>
</html>

HTML file with Dojo refuses to work from my local machine

I am using some CDN links in a file copied directly from a dojo tutorial. I can't figure out why it won't work. There is supposed to be a dialog when you click the Show Me! button but the parts of the dialog are just visible on the page and the button does nothing.
<!DOCTYPE html>
<html >
<head>
<link href="http://ajax.googleapis.com/ajax/libs/dojo/1.7.4/dijit/themes/claro/claro.css" type="text/css" rel="stylesheet" />
<script>dojoConfig = {parseOnLoad: true}</script>
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.7.4/dojo/dojo.js"
data-dojo-config="async: true"></script>
<script>
require(["dijit/Dialog", "dijit/form/TextBox", "dijit/form/Button"]);
</script>
</head>
<body class="claro">
<div data-dojo-type="dijit/Dialog" data-dojo-id="myDialog" title="Name and Address">
<table class="dijitDialogPaneContentArea">
<tr>
<td><label for="name">Name:</label></td>
<td><input data-dojo-type="dijit/form/TextBox" name="name" id="name"></td>
</tr>
<tr>
<td><label for="address">Address:</label></td>
<td><input data-dojo-type="dijit/form/TextBox" name="address" id="address"> </td>
</tr>
</table>
<div class="dijitDialogPaneActionBar">
<button data-dojo-type="dijit/form/Button" type="submit" id="ok">OK</button>
<button data-dojo-type="dijit/form/Button" type="button" data-dojo-props="onClick:function(){myDialog.hide();}"
id="cancel">Cancel</button>
</div>
</div>
<button data-dojo-type="dijit/form/Button" type="button" onClick="myDialog.show();">
Show me!
</button>
</body>
</html>
You've always got to use a webserver even if you're viewing locally. It simply won't run from your local filesystem.
Run your source code from a web server, not the file system, even if the web server is
running on your development machine. The browser's handling of HTTP requests from the local
file system are more restrictive than from a web server, even when it's running in the same
machine. For consistent results, you should always run Dojo from within any HTTP web server
(Apache, nginx, Tomcat, IIS, Jetty, etc.).
Lucian's remark about the missing http:, that isn't a problem:
You may also load Dojo from a CDN. This is useful for quickly using Dojo, as it doesn't
require you to host your own copy of Dojo. You'll notice in many of our tutorials that we
show protocol-less URLs, e.g. . This allows you to use Dojo within http and https
applications without adjusting the URL. For more information, check out the Dojo CDN
tutorial
See: Dojo Start
First you had a "http:" missing in the second CDN loading thingy. And then it seems that somehow the dijit dialog files aren't loading... ! You could load them manually OR
you could switch the version of dojo from 1.7.4 to 1.8 (i would advise that) by loading 1.8 files & then it should work. Here is the code:
<!DOCTYPE html>
<html >
<head>
<link href="http://ajax.googleapis.com/ajax/libs/dojo/1.8/dijit/themes/claro/claro.css" type="text/css" rel="stylesheet" />
<script>dojoConfig = {parseOnLoad: true}</script>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.8/dojo/dojo.js"
data-dojo-config="async: true"></script>
<script>
require(["dijit/Dialog", "dijit/form/TextBox", "dijit/form/Button"]);
</script>
</head>
<body class="claro">
<div data-dojo-type="dijit/Dialog" data-dojo-id="myDialog" title="Name and Address">
<table class="dijitDialogPaneContentArea">
<tr>
<td><label for="name">Name:</label></td>
<td><input data-dojo-type="dijit/form/TextBox" name="name" id="name"></td>
</tr>
<tr>
<td><label for="address">Address:</label></td>
<td><input data-dojo-type="dijit/form/TextBox" name="address" id="address"> </td>
</tr>
</table>
<div class="dijitDialogPaneActionBar">
<button data-dojo-type="dijit/form/Button" type="submit" id="ok">OK</button>
<button data-dojo-type="dijit/form/Button" type="button" data-dojo-props="onClick:function(){myDialog.hide();}"
id="cancel">Cancel</button>
</div>
</div>
<button data-dojo-type="dijit/form/Button" type="button" onClick="myDialog.show();">
Show me!
</button>
</body>
</html>