hello.
I need help to find a token value in a HTML file.
</div>
<div class="nota"><input type="checkbox" id="desactivarComentario" name="desactivarComentario" /><label for="desactivarComentario">No deseo cargar comentarios para los informes. (modificable en Configuración)</label></div>
</div>
<input name="__RequestVerificationToken" type="hidden" value="XyPDNNtKIHJVg2xhyikMyUcwD26-T9z8HMEWiQh0KXq2vUjMahh2n-nL_fh6_bPJUupSiWc3fcvCdcz-ohZB-4K34WT0-PRXX-MsltnQI8mSYg81kzrFhvByJtLl36D-0" />
<div id="wrapper-resultado" class="cf ly-body">
<div class="cf barra-consulta">
<ul class="left">
<li class="fst">
In this case the value that i should obtain is:
"XyPDNNtKIHJVg2xhyikMyUcwD26-T9z8HMEWiQh0KXq2vUjMahh2n-nL_fh6_bPJUupSiWc3fcvCdcz-ohZB-4K34WT0-PRXX-MsltnQI8mSYg81kzrFhvByJtLl36D-0"
What is the best ever method to find it?
Thanks!
You could use jQuery and execute:
var val = $('input[name="__RequestVerificationToken"]).val();
You can use
var x = document.getElementsByName("__RequestVerificationToken")[0].value;
You can do this vía jQuery, see the code below:
https://jsfiddle.net/monodisco/hj7p8dne/6/
$(document).ready(function() {
var __RequestVerificationToken = $("input[name=__RequestVerificationToken]").val();
alert("__RequestVerificationToken IS ::: " + __RequestVerificationToken);
});
Related
I have a screen login in my aplication and to get the form data in framework i need to use formtoData but it wasnt working, so i decided to create another project and copy paste framework docs script but still isnt working.
Index.html(the test project)
<div class="pages navbar-through toolbar-through">
<!-- Page, "data-page" contains page name -->
<div data-page="index" class="page">
<!-- Scrollable page content -->
<div class="page-content">
<form id="my-form" class="list-block">
<ul>
<li>
<div class="item-content">
<div class="item-inner">
<div class="item-title label">Name</div>
<div class="item-input">
<input type="text" name="name" placeholder="Your name">
</div>
</div>
</div>
</li>
</ul>
</form>
<div class="content-block">
Get Form Data
</div>
</div>
</div>
</div>
js (test project)
// Initialize app
var myApp = new Framework7();
// If we need to use custom DOM library, let's save it to $$ variable:
var $$ = Dom7;
$$('.form-to-data').on('click', function(){
alert("dwdq");
var formData = myApp.formToData('#my-form');
alert(formData);
});
Does anyone know why is it not working? thx in advance.
They changed the function, instead of formToData now is formToJSON
You can use booth:
formtoData or formToJson will return the same value: [object Object]
Just use JSON.stringify() to get the desired result.
$$('.form-to-data').on('click', function(){
var formData = myApp.formToData('#my-form');
var formJSON = myApp.formToJSON("#my-form");
console.log(JSON.stringify(formData));
console.log(JSON.stringify(formJSON));
});
{"name":"Alexandre"}
{"name":"Alexandre"}
Or you can even serialize the form like that:
$$('.form-to-data').on('click', function(){
var formData = $$.serializeObject(myApp.formToJSON($$("#my-form")));
console.log(formData);
});
name=Alexandre
Edit: Framework7 got updated to v4, and now it works this way:
Single Line:
var dados = JSON.stringify(myApp.form.convertToData('#my-form'));
They changed the function again, at least in V2. The new function that works for me is:
var formData = myApp.form.convertToData("#form-id");
var formString = JSON.stringify(formData);
Framework 7 convertToData is ignoring input type text array: for example:
<input type="text" name="no_invoice[]" />
Removing [] doesn't work either.
F7 only take as array checkbox/radio fields, this bug must be solved.
I solved using javascript:
new FormData(your_form);
I have implemented 2 ng-app in single html page and it is not working for second one, Please look into my code and suggest me where I am wrong.
<div id="App1" ng-app="shoppingCart" ng-controller="ShoppingCartController">
<p>Name : <input type="text" data-ng-model="name"></p>
<h1>Hello {{name}}</h1>
<p> Name: <input type="text" id="first_name" ng-model="first_name"></p>
<h1 ng-bind="first_name"></h1>
<div ng-init="firstName='jaskaran'" id="firstName"></div>
<p> This is the first name:<span ng-bind="firstName"></span></p>
<p id ="x">
my first calculation {{5+5}}
</p>
</div>
<div id="App2" ng-app="namesList" ng-controller="NamesController" >
<input type="text" id="firstLast" ng-model="firstLast">
Full Name: {{firstLast}}
</div>
script here
var xApp = angular.module('shoppingCart',[])
xApp.controller ('ShoppingCartController', function($scope) {
}) ;
var app = angular.module('namesList',[])
app.controller('NamesController',function($scope){
$scope.firstLast = "Nitin" ;
});
Visit This URL You Can find the Solution
http://shrestha-manoj.blogspot.in/2014/06/can-angularjs-have-multiple-ng-app.html
only one AngularJS application can be auto-bootstrapped per HTML document. The first ngApp found in the document will be used to define the root element to auto-bootstrap as an application. To run multiple applications in an HTML document you must manually bootstrap them using angular.bootstrap instead.
Try this :
angular.bootstrap(document.getElementById("App2"), ['namesList']);
It will bootstrap your second ng-app directive.
I have two variables, one stores the chexboxes and the other stores the values checked, I found a problem to display the checkboxes and their values (checked, not checked) from the controller to the view.
I have this code on the controller
$scope.infoParticipant = functionThatGetsParticipants();
for (var i = 0; i < $scope.infoParticipant.length; i++) {
if ($scope.infoParticipant[i].ch_type == 'checkbox_multiple') {
var optionsString = $scope.infoParticipant[i].cf_multiple_optionsList;
$scope.infoParticipant[i].optionsTab = optionsString.split(";");
var optionsSelected = $scope.infoParticipant[i].v_value.split(";");
}
}
In the precedent code these should be the values
optionsString = "ch1;ch2;ch3";
$scope.infoParticipant[i].v_value = "ch1;ch2";
According to this the checkboxes :ch1 and ch2 will be checked on the next view :
<div ng-show="l.ch_type=='checkbox_multiple'">
<label >My checkboxes</span></label>
<div class="row" ng-repeat="k in l.optionsTab">
<div class=" col-md-2 modal_style_input">{{k}} </div>
<div class="col-md-2"><input type="checkbox" name="option" class="md-input" id="option {{k}}" class="wizard-icheck" value="{{k}}" icheck ng-model="" /></div>
<div class="col-md-8"></div>
</div>
</div>
My question is how to modify my controller and what to put on ng-model to have my correct chexboxes checked?
Thanks in advance.
In your case, one solution would be to use ngCheck directive in your check boxes.
<input type="checkbox" id="option {{k}}" value="{{k}}" ng-check="isOptionAvailable({{k}})" /></div>
And the isOptionAvailable(opt) is a javascript function that you add to the scope which returns true when k is present in $scope.infoParticipant[i].v_value.
EDIT: To answer your last comment, I created a plunker showing how it works
I have a very strange issue, that results in quite a lot of problems for our visitors.
On a normal textfield, Chrome (and other browsers) suggests strings to prefill. When you hover them and move the mouse away, they are not selected and written in the textbox.
However, in my setup, I have a weird case. When I hover my options, and then move the mouse it, it selects an item in the box. This results in an awful lot of "please enter an email" messages, while the user sees an e-mail on their screen.
See problem in this video:
https://www.youtube.com/watch?v=Vh2nb0_IR3Q
My markup for this particular e-mail:
<input type="text" name="Email" placeholder="E-mail" id="newUserEmail" class="email_input newinputtxt">
Does anyone have a hint? Because i am really lost...
EDIT:
Full ASP.NET MVC markup:
<asp:Content ID="Content1" ContentPlaceHolderID="plhMain" runat="server">
<h2>Indtast e-mail adresse</h2>
<div class="checkout__section checkout__section--login checkout_auth">
<div class="single_login">
<div id="newUserBox">
<div id="provideUserEmailBox">
<div class="email_auth">
<div>
<input type="text" name="Email" placeholder="E-mail" id="newUserEmail" class="email_input newinputtxt" />
</div>
<span class="red auth-error-text" style="display: none;" id="invalidEmailText">Der skal indtastes en gyldig e-mail</span>
<ul class="red_checkmarks" style="margin-top: 5px;">
<li>Vi bruger e-mail adressen til at sende en bekræftelse pa din ordre</li>
<li>Hvis du vil, kan du logge ind eller oprette en konto på næste side.</li>
</ul>
</div>
</div>
<div id="createNewUserBtnBox">
<input id="newUserBtn" type="button" class="button button--primary" value="Fortsæt" />
<span class="red auth-error-text" id="createNewUserErrorText"></span>
</div>
</div>
</div>
<div id="socialLoginList">
<button class="pfacebook" type="button" name="provider" value="facebook" title="Log ind med din Facebook konto">
Facebook
</button>
<button class="pgoogle" type="button" name="provider" value="google" title="Log ind med din Google konto">
Google
</button>
</div>
</div>
<script type="text/javascript">
$(function () {
$("#newUserEmail").keypress(function (event) {
if (event.keyCode == 13) {
event.preventDefault();
$("#newUserBtn").click();
}
});
var auth = CheckoutAuthorizationFlow({ LoginUserBox: "#loginWithUserBox", NewUserBox: "#newUserBox" });
auth.Init();
var facebookLogin = function () {
var loginUrl = '/login?returnurl=' + encodeURIComponent(document.location.href) + '&r=' + (new Date().toUTCString()) + '&provider=facebook';
//alert('facebook login');
document.location.href = loginUrl;
return;
};
var googleLogin = function () {
var loginUrl = '/login?returnurl=' + encodeURIComponent(document.location.href) + '&r=' + (new Date().toUTCString()) + '&provider=google';
document.location.href = loginUrl;
return;
};
$(".pfacebook").click(facebookLogin);
$(".pgoogle").click(googleLogin);
});
</script>
</asp:Content>
So my roommate, who has been working a bit with Wordpress a couple of years back, just came by my computer and said:
"Wrap it in a form tag!"
So I told him that was a horrible idea, and he said "try it".
And I did.
And it fucking worked.
So tl;dr -> wrap it in a form tag, and it works... I'll go cry.
http://i.stack.imgur.com/o2Kht.png
Basically I want these buttons to be side by side.
I've put them in a container but I cannot get them side by side like the example below.
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css"> <!-- Linking Style Sheets -->
</head>
<body>
<style type="text/css">
<!-- Background image -->
</style>
<div class="img-wrapper-center" id="titlebar">
<img src="titlebar.png" id="img1"/>
</div>
</div>
<div id="bodycontainer">
<div id="text">
Welcome to the shop, you can add your items to to the cart below
</div>
<div id="formcontainer">
<div id="myForm">
<form name="theForm" action="shop.html" method="post" onSubmit="return checkWholeForm(theForm)">
<input type="radio" name="ram" value="yes">yes<br>
<input type="radio" name="ram" value="no">no
<br><br>
<input type="radio" name="cpu" value="yes">yes<br>
<input type="radio" name="cpu" value="no">no
<br><br>
<input type="radio" name="harddrive" value="yes">yes<br>
<input type="radio" name="harddrive" value="no">no
<br><br>
</div>
<div id="submitbuttons">
<input type="submit" value="Submit">
<input type="reset">
</div>
</div>
</form>
<div id="buttoncontainer">
<div class="homebtn">
<a href="..\home.html" onmouseover="SwapOut()" onmouseout="SwapBack()"><img name="homebtn" src="homebuttonup.png"/>
</a>
<div class="shopbtn">
<a href="shop.html" onmouseover="SwapOutshop()" onmouseout="SwapBackshop()"><img name="shopbtn" src="shopbuttonup.png"/>
</a>
</div>
</div>
</body>
<!-- Start of rollover script -->
<script>
Rollimage = new Array()
Rollimage[0]= new Image(121,153)
Rollimage[0].src = "homebuttonup.png"
Rollimage[1] = new Image(121,153)
Rollimage[1].src = "homebutton.png"
function SwapOut() {
document.homebtn.src = Rollimage[1].src;
return true;
}
function SwapBack() {
document.homebtn.src = Rollimage[0].src;
return true;
}
Rollimageshop = new Array()
Rollimageshop[0]= new Image(121,153)
Rollimageshop[0].src = "shopbuttonup.png"
Rollimageshop[1] = new Image(121,153)
Rollimageshop[1].src = "shopbutton.png"
function SwapOutshop() {
document.shopbtn.src = Rollimageshop[1].src;
return true;
}
function SwapBackshop() {
document.shopbtn.src = Rollimageshop[0].src;
return true;
}
</script>
<!-- end of rollover script -->
<!-- Start of form validation -->
<script>
function checkWholeForm(theForm) {
var reason = '';
reason += checkRadioButtons(theForm.ram);
if (reason != '') {
alert(reason);
return false;
}
return true;
}
function checkRadioButtons(radiobuttons) {
var checkvalue = "";
var i=0;
var error = "";
var amountOfRadioButtons = radiobuttons.length;
for (i=0; i<amountOfRadioButtons; i++) {
if (radiobuttons[i].checked) {
checkvalue = theForm.ram[i].value;
}
}
if (!(checkvalue)) {
error = "Please choose an option for RAM.\n"
}
return error;
}
</script>
<!-- End of form validation -->
Sorry for delay, rofl im new to adding code to this so i did not know how to ident it.
.homebtn, .shopbtn{
display:inline; /*or inline-block*/
}
I made a jsfiddle here using images from google image search because I don't have access to your images, but the css should be quite similar for your own uses.
You should also fix your html for the button container
<div id="buttoncontainer">
<div class="homebtn">
<a href="..\home.html" onmouseover="SwapOut()" onmouseout="SwapBack()">
<img name="homebtn" src="homebuttonup.png"/>
</a>
</div>
<div class="shopbtn">
<a href="shop.html" onmouseover="SwapOutshop()" onmouseout="SwapBackshop()">
<img name="shopbtn" src="shopbuttonup.png"/>
</a>
</div>
</div>
You currently have one button nested inside of the other.
Looking at your code, I can spot a few areas that can be improved.
First, you're using JavaScript to handle the button rollovers. Unless there is a specific reason to be doing this, it isn't necessary. A more efficient way to do this would be to use pure CSS for the button rollovers.
Second, you have the images embedded in the link itself:
<a href="..\home.html" onmouseover="SwapOut()" onmouseout="SwapBack()"><img name="homebtn" src="homebuttonup.png"/>
</a>
If you were to actually use CSS based navigation, you wouldn't need to do this. The benefit is less code and ultimately page size and load time. Keep in mind, every image loading is a separate HTTP Request to the server. This equals more bandwidth in the long run. Your website may not be effected by this type of stuff, but it's good practice; best practices.
I have created a JSFiddle to show you how I would approach your navigation. One other thing I would add is putting all of the navigation imagery into a Sprite.
http://jsfiddle.net/cbPRv/