I want to click the submit button of the webpage i am displaying in my Web Browser but it seems not to work at all here is my code:
WebBrowser1.Document.Forms(0).InvokeMember("image")
i was basing on the html code of the button i want to click which is:
<div class="buttonRow forward">
<input type="image" src="includes/templates/template_default/buttons/english/button_send.gif" alt="Send Now" title=" Send Now ">
</div>
did i miss something? i really need help.
Try setting this property
Webbrowser.AllowNavigation = True
Related
I have been getting a 400 error, and cut the code down to a very basic form post, and still get this error.
It happens once only on first attempt (i.e. first time page is loaded ever, then, go back, press button, and all ok)
I have found that it is related to "antiforgery", and if i disable this, all works perfect first time
<div class="text-center">
<form method="post">
<button id="btnLogin" type="submit" asp-page-handler="BtnSignin">Login</button>
</form>
The above is my HTML, and below is the c#:
public async Task<IActionResult> OnPostBtnSignin()
{
return null;
}
(i know returning null isnt ideal, but, for my debugging, it confirms if i get the 400 error or not)
if I publish (to aws lambda), on first button press, it errors, go back, press button, and this time, no error
if i disable "antiforgery", it works (have tried, and its consistent either way round)
Any ideas on why? and how to fix? (without disabling antiforgery)
Try to add #Html.AntiForgeryToken() to your form:
<form method="post">
#Html.AntiForgeryToken()
<button id="btnLogin" type="submit" asp-page-handler="BtnSignin">Login</button>
</form>
Both <form method="post"></form> and #Html.AntiForgeryToken() will result in the __RequestVerificationToken hidden field being added to the page.So if your form cannot add __RequestVerificationToken to page,you can try to add #Html.AntiForgeryToken().
I'm using Magnific popup our product product pages as a method for image hot points. Right now when you click on a hot point a popup appears with larger image and text. I received a request to open the popup on a mouseover.
Is there a way to trigger open Magnific Popup on a mouseover not on a mouse click?
I was trying to call the mouseover event on the link first, but it seems the Popup still requires a click. How to I make it so it opens up just with a mouseover?
<!-- Popup link -->
Show inline popup
<!-- Popup itself -->
<div id="test-popup" class="white-popup mfp-hide">
Popup content
</div>
Javascript:
$('.open-popup-link').mouseover(function(){
$(this).magnificPopup({
type: 'inline'
});
});
Answering my own question. After a bit more research I found that I needed to open the popup directly via API. It works now:
$('.open-popup-link').mouseover(function(){
$.magnificPopup.open({
items: {
src: '.white-popup' // can be a HTML string, jQuery object, or CSS selector
}
})
});
Working example: https://codepen.io/pen/ZKrVNK
Taking it further with multiple links opening separate slides of a gallery, using event delegation:
http://codepen.io/pen/EmEOMa
I have a set of buttons that each can open the modal. The first one opens fine, but if you don't close the modal the second one fails with 'Uncaught TypeError: undefined is not a function.
I have a bunch of links:
<a data-toggle="modal" data-dismiss="modal" data-target="#modal-form" href="partial/forums-modal.html">Open Modal A</a>
<a data-toggle="modal" data-dismiss="modal" data-target="#modal-form" href="partial/facebook-modal.html">Open Modal B</a>
I tried: Twitter Bootstrap open modal over an already opened modal
Not a big help either. Hiding a previous modal when opening a new one.
Yes I have jquery loaded before bootstrap.
The fix for the first error 'Uncaught TypeError' was to upgrade from bootstrap 3.1.1 to 3.2.0. Once this is done, clicking on the second div, the modal closes rather than staying open with the new content.
To update the content, I went down the ajax path. These modals are themselves loaded by ajax (mobile-first and they aren't mobile). Therefore, in a similar vein to Reload Content in Modal Twitter Bootstrap I used the following code:
$('body').on('click', 'a[data-target=#modal-form]', function(ev) {
console.log("clicked");
ev.preventDefault();
var target = $(this).attr('href');
$('#modal-form').load(target, function() {
$('#modal-form').modal("show");
});
});
Hi Experts,
I want to know if it is possible in Struts 1.x to display a
confirmation dialog from Struts Action. In more detail :
I have Action Form,Action Class and importList.jsp file. When i click
a button(on the main Jsp file) .. the current importList.jsp is
displayed by setting the properties of Action Form. In this jsp file i
have ok and cancel button. When i click OK button, on the basis of
some condition i want to show the confirmation dialog saying yes or
no, if the user clicks yes it will move forward, and on cancel.. it
will move to main jsp file(not to importList.jsp file)
Any ideas ....
You can use javascript to get this done. Instead of "Yes/No" dialog you will get "Ok/Cancel" dialog box. You will have to replace "importList url" and "main page url" with your actual urls.
This may not be syntactically accurate but it's a start.
<head>
<script type="text/javascript">
$(document).ready(function(){
$('input[type=submit]').click(function(){
var answer = confirm("You will be forwarded. ");
if(answer){
//your logic
document.location.href="importList url";
}else{
//your logic
document.location.href="main page url";
}
});
});
</script>
</head>
<body>
<input type="submit" value="Ok" />
</body>
I'm running a login form, which - in case of success - forwards the user to a specific page via JS location.href. The browsers correctly recognize the form as a login form and offer to save the password. Now only in Google Chrome, the prompt disappears once the location changes. So the prompt is visible for just a split second, making it impossible to save the password.Is there any solution for this? Refreshing after login success is a common thing, so there should be a way to fix this..
Edit:
This is what the form looks like:
<form id="loginform" action="process.php" target="processframe" method="POST">
<input id="login_name" name="name" type="text" placeholder="Username"><br>
<input id="login_password" name="password" type="password" placeholder="Password"><br>
<button>Submit</button>
</form>
<iframe src="" id="processframe" name="processframe" style="display:none;"></iframe>
So the request is processed in an iframe. process.php then calls a javascript function:
window.setTimeout("parent.loginsuccess()", 1000);
The loginsuccess() function:
function loginsuccess()
{
location.href="/home.php";
}