Captcha Html Form - html

I followed Captcha's Tutorial and did this:
Paste this snippet before the closing </head> tag on your HTML template:
<script src='https://www.google.com/recaptcha/api.js'></script>
Paste this snippet at the end of the <form> where you want the reCAPTCHA widget to appear:
<div class="g-recaptcha" data-sitekey="key"></div>
I want to know how I can make a form to use the captcha in. I just want a basic form that you have to solve a captcha before you can see some text. So you solve the captcha and press the button and it shows some text like hidden message. I can't find this anywhere. Help me! I prefer plain html.

When your users submit the form where you integrated reCAPTCHA, you'll get as part of the payload a string with the name "g-recaptcha-response". In order to check whether Google has verified that user, send a POST request with these parameters
You need to send POST to URL https://www.google.com/recaptcha/api/siteverify with parameters what you see on your google reCAPTCHA account.
If you want BEFORE submitting form, add data-callback attribute to your g-recaptcha-tag. Inside that attribude set name of function that show hidden content only for successfully verifed users.
For more info check reCAPTCHA documentation.
Example
In your javascript define function to show hidden content:
function alertSuccess() {
$(".hidden.message").show();
//alert("Success");
}
In reCAPTCHA
<div data-callback="alertSuccess" class="g-recaptcha" data-sitekey="__YOUR_SECRET_KEY__"></div>

Related

Which Captcha or related is easy to is install on form?

I am a newbie to programming and I already struggled a lot for a week to have a fully functional form that validates, stores data, and then redirects.
Please let me know about a captcha that is easy to install and doesn't mess up my code resulting in data not being sent to PHP which javascript did to me.
A very cheap way of doing a quick and dirty check could be something like this:
<form name="form" method="post">
<!-- your other form fields -->
<input type="text" id="title" name="title" value="somethingsomething">
<input type="submit" value="send">
</form>
You can make the field invisible and choose a name, that a bot would definitely fill out. Choose anything meaningful just not something like "antispam" or the like.
input#title {
visibility: hidden;
height: 0;
width: 0;
}
And then just check if the input field got set:
<?php
if (isset($_POST["title"])) {
// a bot had filled the field now, do something
}
?>
The concept is called "honeypot". You can also check out this stackoverflow post here:
Better Honeypot Implementation (Form Anti-Spam)
You can use the google cpatcha.
You do not have to code at all
Procedure
1.Log on to your Google account.
2.Access https://www.google.com/recaptcha/adminInformation published on non-SAP site from your browser.
3.Select the Invisible reCAPTCHA radio button.
4.Register your domain.
Remember
Your domain is the URL of your Identity Authentication tenant. It has the <tenant ID>.accounts.ondemand.com pattern.
Tenant ID is automatically generated by the system. The first administrator created for the tenant receives an activation e-mail with a URL in it. This URL contains the tenant ID.
5.Save your Site key and your Secret key. You need them for the configuration steps in the administration console for Identity Authentication.
Source of answer
[Try this
The best CAPTCHA codes
No CAPTCHA reCAPTCHA
Image CAPTCHA
add a CAPTCHA to your website
][1]
document :- url [1]: https://internet.com/website-building/how-to-add-a-captcha-to-your-website/
Try this:
Register an hcaptcha account and follow it's instructions.
Add <script src="https://hcaptcha.com/1/api.js" async defer></script> to your head if you have not already done so
Add <div class="h-captcha" id="captcha" data-sitekey="INSERT SITEKEY HERE" data-theme="dark"></div> (Leave data-theme="dark" in for dark theme).
In your form tag, add onsubmit="return checkCaptcha()" as an attribute, like so: <form onsubmit="return checkCaptcha()">
Add the function below to your JS code:
function checkCaptcha() {
if (hcaptcha.getResponse() == "") {
return false;
} else {
return true;
}
}

How to receive form input from asp form before moving to another page?

I want to receive an input from a form (asp (C#)) and use this information in another page. The form's action is to go to another place.
I tried using:
Session["UserNameLog"] = Request.Form["user"];
But it doesn't succeed to get the info before moving to the other page...
<form action="index.aspx" class="formcontainer" id="formcontainer" method="post" runat="server">
Session["UserNameLog"] = Request.Form["user"];
I have also tried to use:
if(Page.isPostBack)
but the page is not back because I'm moving to another page...
Please help...
Thanks!

Simple cross domain form posting not working (whmcs)

I am trying to get a search box to post its content into a searchbox on another domain, using the html post method, however its not working after being redirected to the second site the search box remains empty on site 2.
Both servers belong to the same business and I have access to both, can someone tell me what I could do without using java to get the contents from the input box 1 on site 1 posted to the input box 2 on site 2
here is the line of code I am using on the first site.
form action="https://site2.com/cart.php?a=add&domain" method="post"
Thanks
You''ll need to catch and process both the GET arguments (in your action URL) and the POST stream (from the form elements) in the site2.com/cart.php file that you are using as the action.
Assuming the input box on site1 is named inputBox and is contained in the form with that action, when the form is submitted the site2.com/cart.php script can access the value at $_POST['inputBox'] - ie, wherever that goes on site2, you could do
<form name="someformonsite2" action="....">
<input type=text
<?php
if((!empty($_POST['inputBox'])&&(passes_your_validation($_POST['inputBox']))){
print("value=\"".$_POST['inputBox']."" );
}
?>
size=12 maxlength=11>
<!-- rest of form follows -->
Which would effectively send to the browser:
<input type=text value="SomeVal" size=12 maxlength=11>

google apps script HTMLService button click opens new blank tab

Fairly new to HTML Service in apps script, have written a very basic UI.
The problem is that when the button is clicked (no onclick handler set) it opens up a new blank tab (I'm using Chrome).
Code below reproduces the behaviour, I have jquery / jquery UI references which are used in the broader project so left them in here.
How do I stop this blank tab opening on button click? Not shown here but it also happens when entered hit in a text box.
code.js:
function NewProposal() {
var html = HtmlService.createTemplateFromFile('Index');
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.show(html.evaluate().setHeight(530).setWidth(1100).setSandboxMode(HtmlService.SandboxMode.IFRAME));
}
Index.html:
<!DOCTYPE html>
<base target="_top">
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/cupertino/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.4.1/jsgrid.min.js"></script>
<form>
<table>
<tr>
<td>
<button id="Create">Create</button>
</td>
</tr>
</table>
</form>
You'll need to either get rid of the button, and use something else, or get rid of the form tags, and use div tags. If you get rid of the form tags, then it's more difficult to collect data from any input tags in the form. But, I don't see any input tags in your form. If you have no input tags in your form, then using form tags is pointless. Maybe you just left them out for purposes of reproducing the error in as little code as possible.
When a button is clicked inside of a form tag, the default behavior is for the current window to issue a POST request. That refreshes the content in the browser, but if there is no callback to display some other content, the page will go blank.
The only way to avoid this built-in feature of a form with a button, is to not use a button, or not use the form tags.
A click event can be added to multiple different types of HTML elements. Like a link <a> tags. Or a <div>. So, you can use something else other than a button, style it to look like a button if you wish, and add a click event to whatever you decide to use.
If you have lots of different types of input tags, it may be better to continue to use the form. But if you can easily get all the data out of the table some other way, you don't really need the form. The form adds nothing to the capability of styling or layout. So, if the benefit of using the form doesn't fit your circumstance, then you can look at other options.
If you want to give feedback to the user about what inputs are required, that's another issue. The form tags, the required attribute, and the button submission are all part of a system to try to make form submission more automatic, and make data validation and data collection easier. But, in order to use that "built-in" functionality, it all needs to work together in a certain way. As with anything that people try to make generic, it's very difficult to make it fit all circumstances. If you don't want the page to go blank when the button is clicked, all of that built-in behavior can become more of a detriment than a help.
When Apps Script gets the form, it strips out most of the content from the form element, and creates an object of input names and their values. So, when the "form" object (No longer a real form object) gets to the server, the only way you can get the values out of the object is by using the name attributes.
Add onsubmit="return(false)" inside your form openning tag:
<form onsubmit="return(false)">
...
</form>

html input send information to another website

I'm trying to send a string from an input box to Google's search input to search on my website.
The only way that I can think of is Posting it to my own page which then sends it to google.
Is there a way to cut out that middle page and go straight to google?
Summary: Send input box string to Google's input box and search using Google.
Current thoughts of how to do this are.
Make form with input box
Submit form to seperate page
Seperate page then redirects you to "https://www.google.com/#q=" $_POST['string'] "site:mysite.com"
But I feel like there's a better way to do this.
Thanks
<input type="text" class="foo">
<button onclick="send()">Submit</button>
<script type="text/javascript">
function send(){
var value = $('.foo').val();
window.location.href = "https://www.google.com/#q="+value+" site:mysite.com";
}
</script>