Why are my html5 labels not displaying in Live Web Preview? - asp.net

I added this (taken straight from a book, "HTML5 24-Hour Trainer") to Default.aspx in an asp.net web project:
<form method="post" action="">
<fieldset>
<legend>Personal details</legend>
<p>
<label for="Name"> Name:</label>
<input type="text" name="name" id="Name"/>
</p>
<p>
<label for="Email"> Email:</label>
<input type="text" name="email" id="Email"/>
</p>
<p>
<label for="Tel"> Telephone:</label>
<input type="text" name="tel" id="Tel"/>
</p>
</fieldset>
<p>
<input type="submit" value="Submit"/>
</p>
</form>
The labels ("Name:", "Email:", and "Telephone:") are not displaying next to the text input controls (edit boxes) - or anywhere else (visible to me) for that matter if I select "Live Web Preview" (Ctrl+Alt+Enter). However, if I select View In Browser (Ctrl+Shift+W), I can see the labels.
And if I look at the page in any of my three options (Google Chrome, Internal Web Browser, or Internet Explorer), it works fine; it is only the Live Web Preview that is busted.
So the question is, why are the labels invisible with "Live Web Preview"? But I guess I'll just avoid that viewing option; no big deal.

Tried the exact same thing and it works as expected. I guess it's a local issue. Need more info.

Related

Logging in and scraping a site like ft.com with BeautifulSoup

I have this url: https://www.ft.com/content/87d644fc-73a4-11e7-aca6-c6bd07df1a3c
It corresponds to an article that requires signing up. I signed up and can see the content in my browser. However when I use this code with the url above:
soup = BeautifulSoup(urllib2.urlopen(url), 'lxml')
with open('ctp_output.txt', 'w') as f:
for tag in soup.find_all('p'):
f.write(tag.text.encode('utf-8') + '\n')
Especially, it redirects me on the signup page. Is there any way to be logged in to have access to the article when scraping?
Here are the basics.
Go to the login page. If you use the Chrome browser you can position your mouse over the email input area and use the context menu (in Windows) and then its 'Inspect' entry to reveal the form element that will be used to submit your email address. It looks like this.
<form name="enter-email-form" action="/login/submitEmail" class="js-email-lookup-form" method="POST" data-test-id="enter-email-form" novalidate="true">
<input type="hidden" name="location" value="https://www.ft.com/content/87d644fc-73a4-11e7-aca6-c6bd07df1a3c">
<input type="hidden" name="continueUrl" value="">
<input type="hidden" name="readerId" value="">
<input type="hidden" name="loginUrl" value="/login?location=https%3A%2F%2Fwww.ft.com%2Fcontent%2F87d644fc-73a4-11e7-aca6-c6bd07df1a3c">
<div class="lgn-box__title">
<h1 class="lgn-heading--alpha">Sign in</h1>
</div>
<div class="o-forms-group">
<label for="email" class="o-forms-label">Email address</label>
<input type="email" id="email" class="o-forms-text js-email" name="email" maxlength="64" autocomplete="off" autofocus="" required="">
<input type="password" id="password" name="password" style="display:none">
<label for="password">
</label></div>
<div class="o-forms-group">
<button class="o-buttons o-buttons--standout o-buttons--big" type="submit" name="Next">Next</button>
</div>
</form>
You will need to gather the action attribute from the form element and all the name-value pairs from the input statements. You use these in a POST request with the requests library.
You do this once for your email address and once for your password. Then you should be able to issue the GET for the URL with requests.
I must warn you that I haven't actually tried this with that particular site.
If you are to scrape a website using BeautifulSoup, I'd recommend the MechanicalSoup library. It is a very lightweight layer on top of BeautifulSoup (to parse HTML) and requests (to fetch pages), but it will deal for you with things like filling-in a form properly (i.e. what you need here), following relative links, ...
MechanicalSoup is also limited in the sense that it doesn't interpret JavaScript code, hence won't work on a website relying on JavaScript, but it reduces the manual effort compared to using BeautifulSoup and urllib or requests directly.
(Note: I'm one of the authors of MechanicalSoup)

Integrating a custom built form with a subscriber list provider (Aweber)

I have created my own form because every other form out there for WordPress is horrible.
div class="exc-form">
<form action="action_page.php">
<fieldset>
<div id="form_jgrsh">
First name:<br>
<input type="text" name="firstname" placeholder="Please enter first name">
<br>
Last name:<br>
<input type="text" name="lastname" placeholder="Please enter last name">
<br>
Email:<br>
<input type="text" name="email" placeholder="Please enter email">
<div class="chk_bx">
<input type="checkbox" name="concent" value="agree">By entering my information and pressing submit I agree to subscribing to the Stockhouse AND Junior Gold Report (please check box before submiting)
<br>
</div>
<input type="submit" class="submit-btn" value="Submit">
</div>
</fieldset>
</form>
It's super simple and isn't anything special. I'm under the impression PHP will be needed as well.
I use Aweber as my list provider, and I've contacted them for support and they want me to use their horrible, ugly form builder, and won't help me integrate my own form to use their list.
I've never done something like this before, so I'm looking for some guidance on how to send subscriber information to a list. Aweber offer's a list ID and most plugins I've seen require a Aweber authentication before Aweber links up to the list.
https://labs.aweber.com/snippets/lists - this is as closest to the resources I could find from Aweber.
Here is the authentication list: https://labs.aweber.com/snippets/authentication

Anti-Fogery not working correctly in asp.net Razor

I have an ASP.NET Webpages Razor syntax page which all of a sudden has stopped authenticating users!
If a user tries to login to the site now the server responds with the message:
The required anti-forgery form field "__RequestVerificationToken" is not present.
Well.... It is!
Looking at the source of my login page it does add the hidden field as seen below..
<section id="loginForm">
<form method="post">
<fieldset>
<input name="__RequestVerificationToken" type="hidden" value="WgwaKIsXipJ4C8IRsaz__C_tW02ejupv8af-w3czwefo2AEacVlGs_k-lFNRfLqWr0inzHxtkEnXgPKZMvacv5u1LVfLphIP8R1JGukMZcA1" />
<legend>Sign in to Your Account</legend>
<ol>
<li class="email">
<label for="email" >Username</label>
<input type="text" id="email" name="username" />
<span class="field-validation-valid" data-valmsg-for="username" data-valmsg-replace="true"></span>
</li>
<li class="password">
<label for="password" >Password</label>
<input type="password" id="password" name="password" />
<span class="field-validation-valid" data-valmsg-for="password" data-valmsg-replace="true"></span>
</li>
<li class="remember-me">
<input type="checkbox" id="rememberMe" name="rememberMe" />
<label class="checkbox" for="rememberMe">Remember me?</label>
</li>
</ol>
<input type="submit" value="Sign in" />
</fieldset>
</form>
</section>
To create this field I use #AntiFogery.GetHTML() and in the post method which authenticates users I have #AntiForgery.Validate() <---- This is where the website crashes and shows me the aforementioned error.
I don't know if this helps. but if i remove the validation all together (Server and client) I get a 403 error when attempting to login to the website.
Oddly enough this has happened all of a sudden without any intervention?
Finally, On my local machine this does not happen. Only when hosted on IIS 8
I have finally discovered the issue with the IIS Server!
On my webserver I have a tool called ModSecurity Installed that was obviously interfering with my POST requests.
By adding the line, <ModSecurity enabled="false" />, into the web.config of the site everything was returned to its original state.
I hope this helps anyone else in the future with this issue

Microsoft Edge and IE11 doesn't invoke servlet

I'm testing an existing web app from a Windows 10 environment.
Current versions of Firefox, Chrome and Opera work as expected but Edge and IE11 don't.
The welcome page (html) of the app displays correctly but when submit is invoked nothing happens i.e doesn't move off welcome page and run the servlet. There are no error messages, no relevant server log entries. When I run the app from within a NetBeans IDE the monitor shows only the requests for the welcome page, none for the servlet request.
The symptoms are the same for Tomcat and Glassfish.
IE9 on a Windows XP system works so, for fun, I played with x-ua-compatible settings in the welcome page html but no resolution.
Any pointers would be appreciated.
Sampson - playing around with the welcome html file, I have found a solution. The original code segment was
<div class ="text">
<form id="plant_select" action="Search">
<input name="name" placeholder="enter name" class="inputtext" autofocus required>
</form>
<p style = "padding-top:20px"><input type="submit" value="Search" form="plant_select"></p>
</div>
By moving the submit line into the form tag thus
<div class ="text">
<form id="plant_select" action="Search">
<input name="name" placeholder="enter name" class="inputtext" autofocus required>
<p style = "padding-top:20px"><input type="submit" value="Search" form="plant_select"></p>
</form>
</div>
The app now works for IE11 and Edge.
The original code worked for all available browsers at the time and was passed by an HTML5 validator. Hope this is of interest to you.

Text Input Types with Gravityforms

I currently build a complex form with gravityforms. What i need is an area where i have some text and in between the text are some input-fields to complete the text paragraph.
EXAMPLE.
I,"name-inputfield"____, agree to be available between__"text-inputfield"__ and ____.
I already created that in a html editor and placed the code into a HTML Box of Gravityforms but if submit the information are not delivered. I believe i forget something inside the formcode.
I attached the code below
I, <input type="text" name="" value="NAME" size="40">(for myself and my heirs and legal representatives) of<br>
<input type="text" name="" value="STREET ADDRESS" size="40"><input type="text" name="" value="CITY" size="20" maxlength="20"><input type="text" name="a78" value="ST" size="2" maxlength="2"><input type="text" name="" value="ZIP" size="10" maxlength="10"><br>
hereby release Blanca's house Corp., its agents, representatives, directors, employees, contractors, insurers, and members from any and all responsibility and liability involving arising out of, or related to the planned medical mission scheduled to <span class=""><input type="text" name=" " value="" size="20" maxlength="20">starting on <input type="text" name="" value="" size="20" maxlength="20"> through <input type="text" name="" value="" size="20" maxlength="20"> 20<input type="text" name="" value="" size="2" maxlength="2">, including (without limitation) liability regarding my health or safety or my personal property.
Would be great if anybody could help me, because i never did something like this.
Here is also a screenshot of how it looks inside the browser http://awesomescreenshot.com/01e2la0ibc
Thanks a lot for any help
Inputs inside the content of the HTML field will not be captured by Gravity Forms. They aren't "registered" by Gravity Forms so it doesn't know they exist.
There are two alternatives for what you are trying to accomplish.
You can add the fields via Gravity Forms and then style them to be inline. Here is a great example of how this can be accomplished:
http://www.rocketgenius.com/gravity-forms-mad-lib-style-form-demo/
You can add the fields via Gravity Forms and then output the submitted values in an HTML field on a second page. Here is a example of this using my product GP Preview Submission: http://demos.gravitywiz.com/gp-preview-submission/

Resources