I am making a Reddit comment bot that will crawl subreddits as it finds links in the pages. My problem is that when I try to crawl NSFW subreddits with an 18+ age question, despite clicking "yes" in my normal browser, Reddit returns a 18+ age question every time the C# bot hits those pages.
Is there a way to avoid this or to click the "yes" button programatically?
yes there is a way, look at the HTML form for the question:
<form method="post" action="" class="pretty-form">
<input type="hidden" name="uh" value="">
<p>are you over eighteen and willing to see adult content?</p>
<p>
<button type="submit" name="over18" value="yes">yes</button>
<button type="submit" name="over18" value="no">no</button>
</p>
</form>
You could fill out the values and then submit the POST request.
Related
So I have a basic crud that displays information on ASP.Net using entity framework. When i click details it shows the information for that row on a table. I've input a button and a label that when is clicked shows a number, when clicked again it will show the next number higher. It's basically to just a button counter written with JQuery. My question is, is there a way to save this number? I want to store the data in the program so it doesn't forget the number when I move to a different page.
Here is the JQuery.
var count = 0;
function Count() {
count++;
$('#lblShow').text(count);
}
<div>
<input type="submit" name="btnCount" value="Add Signature" onclick="return Count();" id="btnCount" /> <input type="submit" name="btnCountSoc" value="Post to Social Media" id="btnMedia" />
<span id="lblShow"></span>
</div>
Any advice would be appreciated, thanks.
You can use cookies like :
var counter = $("#foo").val();
document.cookie = "counter="+counter";path=/";
My web assignment has asked me to create a dating site login page and display the information, i have completed the HTML to a point and am now beginning with the C#. I have began this but have come to a standstill as I dont know what is going wrong to display the information.
My question is: How do I get the "fName" to display itself in the "message" as when I submit it, the text comes up but there is no name when I type it into the textbox and submit it.
C#
#{
string message = "";
string fName;
fName = Request.Form["fName"];
string daySelect = Request.Form["submit"];
message = String.Format("Your first name is: {0}", Request.Form["fName"]);
}
HTML
<form method="post">
<label for="fName"></label>
First Name: <input type="text" name="fName" id="fName"
#(Request.Form["fName"]) /> <br/>
<br/><br/><input type="button" value="submit" />
<p>#message</p>
I recommend to look into ASP.NET MVC and how are models passed from controller to their views. This makes things you are doing here a lot of easier and less error prone. There are several tutorials out there.
Just looking at your HTML code a missing value attribute in the input field may be the cause. Please try
First Name: <input type="text" name="fName" id="fName" value="#(Request.Form["fName"])" /> <br/>
I found the problem.
Here is the submit that I have in:
<br/><br/><input type="button" value="submit" />
As you can see the type is button, for this code it should be of type "submit", tiny error in lots of code.
Thanks to rboe for the assistance.
Thanks for checking.
I am building a web application using angularjs. i have two buttons one will do a Ajax post to server using angularjs and the other will to a normal html post to server. the reason i want the second one to do a direct post to server is that i want to generate an excel document on server and return it tp user to download on response.
please how can i disable angularjs from capturing my form submit for the secont submit button
I'd say that the simplest way is to change the button that shouldn't post the form to not be a form button, but another element that doesn't have that default behaviour. That is, change this:
<form>
<input type="text">
<input type="submit" ng-click="doStuff()" value="Ajaxy things">
<input type="submit" value="Real post">
</form>
to:
<form>
<input type="text">
<a ng-click="doStuff()">Ajaxy things</a>
<input type="submit" value="Real post">
</form>
And style the a to look like a button.
On the current website I am working on we have a Html Form that wraps everything and is used by the global search to submit and search when the user presses enter in the "global search" text box.
The problem we are now having is that we have a application form which has its own text boxes within this Html Form and when you press enter it does a onSubmit for the Global Search.
So in short I was wondering if there was any way to change certain specific text boxes to do a different onSubmit than the global search.
Many Thanks,
Vincent Kong
Instead of using type="submit" buttons use regular buttons (type="button") then call javascript to do what you want.
you can use HTML5 formaction Attribute:
<form action="demo_form.asp">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="submit" value="Submit"><br>
<input type="submit" formaction="demo_admin.asp" value="Submit as admin">
</form>
Although this quickly becomes messy, you can set the CommandName attributes on each of your buttons and handle them appropriately (based on the command value of the clicked button) during the postback.
<FORM id=loginForm name=loginForm method=post
action="http://www.example.com/login.php">
<INPUT name=username>
<INPUT name=password>
<INPUT type=submit value="Log In" name=action_login>
</FORM>
Is there any way of changing name=action_login to name=action_signup and post username and password to http://www.example.com/signup.php
in the server site it has name=action_login but I would like to change this on the client side and not touch the server site.
If you are using FireFox, get the Firebug addon which lets you modify markup in real-time.
Chrome has a built-in similar tool.
Right click -> Inspect Element