How to set action attribute with original URL? - html

In the following code, I hope to post the data to original URL, so I set blank for action attribute in <form action='' method='post' enctype='multipart/form-data' id="myformID">, the code works well.
But in IDE of VS Express for Web, the system report validation (XHTML5) warning : action attribute requires a value!
How can I fill in a value for the action attribute?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="js/jquery1.10.2.min.js?isassets=1" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#ToolBarDownload").click(function(){
if (confirm('Do you want to Download')) {
$("#myformID").submit();
}
});
$("#myformID").submit( function(eventObj) {
$('<input />').attr('type', 'hidden')
.attr('name', "myCw")
.attr('value', "mydata")
.appendTo('#myformID');
return true;
});
});
</script>
</head>
<body>
<div id="container">
<form action='' method='post' enctype='multipart/form-data' id="myformID">
</form>
<span id="ToolBarDownload" class="ToolBarButton" style="margin-left:5px">Download</span>
</div>
</body>
</html>

Related

Why does hcaptcha error shows up? Redirecting pages on github.io

Hello im making an hcaptcha redirect page, it dosn't work can anybody help/fix me with this?
So after i do the Hcaptcha id does show "405 error", note that i entered correct site key, thanks! Also im using github.io sites
<html>
<head>
<title>hCaptcha Demo</title>
<script src="https://js.hcaptcha.com/1/api.js" async defer></script>
</head>
<script type="text/javascript">
if (hrecaptcha.getResponse() == "success") {
function Redirect() {
window.location.href = "https://www.youtube.com/";
}
Redirect()
setTimeout(Redirect, 1000);
} else alert("You can't proceed!");
</script>
<body>
<form action="" method="POST">
<div class="h-captcha" data-sitekey="my-sitekey"></div>
<br />
<input type="submit" value="Submit" />
</form>
</body>
</html>
Edit: I noticed about "hrecaptcha" and i edited it but it still wont work

Page reloads after form submission using ng-submit or ng-click, Changing button types is also not working

I have made a form and I need to submit the form but whenever I tried to do the same the page reloads and does nothing! I tried both ng-submit <form> attribute and the ng-click as a <button> attribute! I also tried changing the button type from "submit" to "button" then also I get the same result!
Any help would be seriously appreciated!
Thanks!
hope this simple plunker example helps
https://plnkr.co/edit/5q9149KSs7qJH0R32NAS?p=preview
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.js"></script>
<script src="script.js"></script>
</head>
<body ng-app="App" ng-controller="Ctrl">
<form ng-submit="myFunc()">
<input type="text" ng-model="data">
<input type="submit">
</form>
<p>{{submited}}</p>
<script>
var app = angular.module("App", []);
app.controller("Ctrl", function($scope) {
$scope.submited = [];
$scope.myFunc = function () {
$scope.submited.push($scope.data);
}
});
</script>
</body>
</html>

Print a document since a Sidebar

Example is more easy to Understand.I tried to print a google document by through a side bar.
I have retrieved a script extract on the web.
My result is a printing the contents of the sidebar and not a google document printing .... oops
Can someone help me ?
<!doctype html>
<html lang="en">
<head>
<script type="text/javascript">
function initButtonImprimer() {
var bouton = document.getElementById('button-imprimer');
bouton.onclick = function(e) {
print();
return false;
}
}
</script>
</head>
<body>
...
<div>
...
<input type="button" id="button-imprimer" value="Imprimer" />
...
</div>
...
<script type="text/javascript">
initButtonImprimer();
</script>
</body>
</html>

Tooltip with ng-messages with in-place error

I want to display tooltip for the field when in place error is occured for field.
If ng-message is "required" then tooltip should display "You did not enter a field" when error is cleared then tooltip should not display anything. Again if ng-message is "maxlength" then tooltip should display "Your field is too long".
This is my plunk
index.html:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-ngMessages-directive-production</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.0-beta.2/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.0-beta.2/angular-messages.js"></script>
<script src="script.js"></script>
<script type="text/javascript">
angular.element(document.getElementsByTagName('head')).append(angular.element('<base href="' + window.location.pathname + '" />'));
</script>
</head>
<body ng-app="ngMessagesExample">
<form name="myForm">
<label>
Enter your name:
<input type="text"
name="myName"
ng-model="name"
ng-maxlength="5"
required
data-toggle="tooltip" title="You did not enter a field!"
/>
</label>
<pre>myForm.myName.$error = {{ myForm.myName.$error | json }}</pre>
<div ng-messages="myForm.myName.$error" style="color:red" role="alert">
<div ng-message="required">You did not enter a field</div>
<div ng-message="maxlength">Your field is too long</div>
</div>
</form>
</body>
</html>
script.js:
(function(angular) {
'use strict';
angular.module('ngMessagesExample', ['ngMessages']);
})(window.angular);
Any idea how to add tooltip?
I edited your Plunker as follows:
In the controller I modified the showerror function:
$scope.showerror = function() {
console.log(myForm.myName);
if ($scope.myForm.myName.$error) {
if ($scope.myForm.myName.$error.required == true) {
$scope.message = "You did not enter a field";
} else if ($scope.myForm.myName.$error.maxlength == true) {
$scope.message = "Your field is too long";
}
} else {
$scope.message = "hi";
}
};
Hope this helps.

Dojo 1.7 form setFormValues during startup

Being new to Dojo I'm trying to initialize a Dijit form with values, e.g. read from storage, XHR etc.
However, invoking form.setFormValues() causes an error TypeError: invalid 'in' operand this.formWidgets thrown by http://yandex.st/dojo/1.7.3/dojox//form/manager/_Mixin.js
Is there anything I'm doing wrong or is this a Dojo issue? (The complete sample is also found here: http://pastebin.com/7LUHr3iA)
<!-- language-all: lang-html -->
`
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.7.3/dijit/themes/claro/claro.css" media="screen">
<script type="text/javascript">
dojoConfig = {async: true,parseOnLoad: true};
</script>
    <script type="text/javascript" src="http://yandex.st/dojo/1.7.3/dojo/dojo.js"></script>
<script type="text/javascript">
require(["dijit/form/TextBox","dijit/form/Button","dojox/form/Manager",
"dojo/parser","dojo/dom","dijit/registry"], function () {});
</script>
</head>
<body class="claro">
<form id="myForm" method="post" data-dojo-type="dojox.form.Manager">
<label for="name">Name</label>
<input id="name" name="nameField" data-dojo-type="dijit.form.TextBox"/><br/>
<label for="surname">Surname</label>
<input id="surname" name="surnameField" data-dojo-type="dijit.form.TextBox"/><br/>
<button data-dojo-type="dijit.form.Button">Submit</button>
<script type="dojo/method" event="startup">
var form = dijit.byId("myForm");
form.setFormValues({
nameField: "Hello",
surnameField: "World"
});
</script>
</form>
</body>
</html>
`
Dojo 1.7 is asynchronous. Code should take the form:
require(["dependency"], function(dep) {
// use dependency
});
There is no reason to believe dojox/form/Manager would be loaded when you try to reference it further down the page.
The registry is the correct way to reference the widget, not 1.6 style code of the form dijit.byId. See livedocs.
See also the dojo/domReady! plugin.