How to implement choose squares with street signs reCAPTCHA - javascript

I am making a website form and I would like to be able to use the type of reCAPTCHA where you select all the squares on an image, which contain a certain item (like a street sign). However, it doesn't explain it on google's documentation. This is how you would go about implementing a checkbox reCAPTCHA iN HTML:
<head>
<title>reCAPTCHA demo: Simple page</title>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
</head>
<body>
<form action="?" method="POST">
<div class="g-recaptcha" data-sitekey="your_site_key"></div>
<br/>
<input type="submit" value="Submit">
</form>
</body>
</html>
I was wondering if you have to modify this in any way in order to get the image reCAPTCHA, or if there is a completely different piece of code I would have to implement.

Related

How does this HTML method = "POST" tag work?

I recently started a project that was going to download some data from a certain site. Unfortunately, when I wanted to download html with r.text, I got this code instead of the code I expected:
<html>
<head>
<title>Working...</title>
</head>
<body>
<form method="POST" name="hiddenform" action="some link"><input type="hidden" name="wa" value="wsignin1.0" /><input type="hidden" name="wresult" value="some links tokens and certificates" /><input type="hidden" name="wctx" value="some link" /><noscript><p>Script is disabled. Click Submit to continue.</p><input type="submit" value="Submit" /></noscript></form>
<script language="javascript">
window.setTimeout('document.forms[0].submit()', 0);
</script>
</body>
</html>
When I open this html code in webbrowser it redirects me to a certain site.
Can I send request with python requests module that will work just like that ?
If I did not explain something enough, I would be grateful to write it in a comment.

Get form data and put into a href link?

I'd like to send a SMS on website by
<a href="sms:+12345678?body=form data"
and popup the SMS application on cellphone.
I'd like user to fill the form, javascript get form data and insert into body= in a link.
Does javascript or jquery can do it?
Here is the code I've tried with input
sms-link.min.js is for make SMS links compatible cross devices, but it only works on Android not iOS.
<html>
<body>
<div class="container">
<input type="text" maxlength="5" id="ca_no">
<div class="col-md-12"> Register </div>
</div>
</body>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="sms-link.min.js"></script>
<script>
var card_no=document.getElementById('ca_no').value;
document.addEventListener('DOMContentLoaded', (function () {
link = new SMSLink.link();
link.replaceAll();
}), false);
</script>
</body>
</html>
enter data and click link won't work, it will works when click back with same data which already filled.
You can achieve this in following manner:
Put an event listener on button or anchor click that collects the form data and out it in some variable.
Make an ajax call to some server side scripting language with that stored data.
From server side scripting language you can hit the SMS API with the specified parameter using GET or POST method.
Reference
Here is a simple jquery
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#ca_no").blur(function()
{
var card_no=$('#ca_no').val();
$("#register").text(card_no); //you can remove this
$("#register").attr('href',window.location.href+'?body=EDS'+card_no);
});
});
</script>
</head>
<body>
<div class="container">
<input type="text" maxlength="5" id="ca_no">
<div class="col-md-12">
Register
</div>
</div>
</body>
</html>
Javascript and jquery can do that. but you need to clear what exactly you want to happen
please specify an example of output

Zurb Foundation - Abide validation won't trigger

I'm trying to get Foundation's Abide validation working with a simple static form, but I'm not getting any errors or response from it. I'm expecting to see data-invalid attributes added to the invalid input elements, but they remain unchanged.
I've included Modernizr, jQuery and as far as I can see from the Zurb docs, all the dependencies that Abide requires. I don't care about CSS right now, just want to be able to have Abide validate the form.
Most of the following code has been taken from the Zurb Foundation docs:
<html>
<head>
<title>Abide test...</title>
<script src="js/modernizr.js"></script>
</head>
<body>
<form data-abide id="contact">
<div class="name-field">
<label>Your name
<small>required</small>
<input type="text" required>
</label>
<small class="error">Name is required and must be a string.</small>
</div>
<div class="email-field">
<label>Email
<small>required</small>
<input type="email" required>
</label>
<small class="error">An email address is required.</small>
</div>
<button type="submit">Submit</button>
</form>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/fastclick.js"></script>
<script type="text/javascript" src="js/foundation.js"></script>
<script type="text/javascript" src="js/foundation.abide.js"></script>
<script>
$(document).foundation();
</script>
</body>
</html>
Can anyone see what's wrong with the above? All the .js files are loading, no 404 errors in Chrome console.
It seems that this piece of CSS is required:
meta.foundation-data-attribute-namespace {
font-family: false;
}
Foundation 5 seems to read its global namespace from the font-family property of meta.foundation-data-attribute-namespace (that's kinda weird).
Foundation.css is required. When I forked your fiddle and simply added foundation.css to external resources, data-invalid appends as you'd expect.

Iframe stop break out, but than allow it

Right what I want to do is, display a username and password on the top of a page so you can enter it and than continue on as normal. (I don't care if it stays or breaks out of the iframe at this point)
A number of people log in the same account for teachial details, So currently we have a html page with the user name and password as well as a link to the log in page. I have tried just passing the varibles onto the login page but that a no go sadly.
To add insult to injury this has to be done in html, because it all run from a network drive (I know it a pile of crap on crap it is not mine, nothing I can do about it)
Currently I can stopped the login pages jumping out of the iframe, but then of course you can't login. Any ideas or is it impossible with the limitations in place?
<html>
<head>
<title>Test</title>
</head>
<body>
<p>Username: <b>******</b></p>
<p>Password: <b>******</b></p>
<iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms" name="Embedded Frame" src="LINK" height="100%" width="100%"></iframe>
<body>
</html>
Edit: I should add that I have no control over the login pages they are run my a number of different people across the world. I be happy with just displaying the user name and password so it can be easily copied in to the field
First of all your end tag needs to be like this
Also try this instead of your code! :)
:
<html>
<head>
<title>Test</title>
<script type="text/javaScript">
function True/False() { //what youwant to do put it in here in javascript form:) try an if statement it should work if not use a switch!
}
function Input1() {
//Connect to whatever value you want it to load on.
}
function Input()
{
//password value goes here
}
</script>
</head>
<body>
<br>
<br>
<center>
<div id="Input1()">
<input type="Username" value="" />
</div>
<br>
<div id="Input2()">
<input type="Password" Value="" />
</div>
<!-- in the onclick make a function for it to load-->
<div id="True/False()">
<input type="button" type="button" value="login" onclick="" />
</div>
</center>
<!-- you need to make this a function of True/false and tell it to load when to load. This is an error frame lol.
<iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms" name="Embedded Frame" src="LINK" height="100%" width="100%"></iframe>
-->
</body>
</html>

Firefox ignores JavaScript override of form submit

I have this code
<html>
<head>
<script type="text/javascript" src="my-search.js"></script>
</head>
<body onLoad="my_Init();">
<div>
<form name="id_msearchform" onsubmit="my_EventHandler_Action(); return false;">
<input type="text" name="id_searchphrase" value="example"></input>
<br><br>
<input type="submit" name="id_searchsubmit" value="Search"></input>
</form>
<br><br>
<div id="id_searchresults">No search done...</div>
</div>
</body>
</html>
I don't want the browser to request a new URL. That is why "onsubmit" has "return false;". This code works in Internet Explorer, but Firefox generates a new request. Any ideas what I am doing wrong?
FireBug changes between not wanting to acknowledge there is Javascript reference and showing the Javascript file without any errors... I will update this when i have more to add. I will try various thingsm e.g. try upload it to the net and see if FireFox behaves differently when not running JS on local disk.
Are you sure that you haven't got any errors?
I try with a simple html:
<html>
<head>
<script type="text/javascript" src="my-search.js"></script>
</head>
<body onLoad="my_Init();">
<div>
<form name="id_msearchform" onsubmit="my_EventHandler_Action(); return false;">
<input type="text" name="id_searchphrase" value="example"></input>
<br><br>
<input type="submit" name="id_searchsubmit" value="Search"></input>
</form>
<br><br>
<div id="id_searchresults">No search done...</div>
</div>
</body>
</html>
And a simple javascript called my-search.js in the same path of my html with the next code:
var my_Init = function(){
alert('Hello Onload');
}
var my_EventHandler_Action = function(){
alert('Hello OnSubmit');
}
And it works fine.
Can you show a live demo (with dropbox or something)?
Instead of using a submit button, try using a button and link the javascript function to that.

Categories