button not redirecting to spring controller - spring

I have a anchor tag enclosing a button I want to redirect it to spring controller when click the button. The below code is working on chrome browser but it is not working in IE. could you please help me?
<spring:url value="/auth/userhome" var="homepage" />
<a href="${homepage}">
<button type="button" class="btn btn-primary cancel">
<spring:message code="button.cancel" />
</button> </a>

You can check this thread: Button inside of anchor link works in Firefox but not in Internet Explorer?
That will fix your problem:
<input type="button" onclick="javascript: location.href = 'http://www.stackoverflow.com';"/>

Related

I'm having trouble clicking a button when scraping with laravel lumen Goutter

I am using laravel / lumen. I need to scrape a page, I am using the Goutte package. This is the HTML. This is the HTML of the page.
<div id="locationMessage">
<div>
<h4>
In order
</h4>
</div>
<div>
<button id="locationChinaNorth" type="button" class="btn">China (Chinese Mainland) - North</button>
</div>
<div>
<button id="locationChinaSouth" type="button" class="btn">China (Chinese Mainland) - South<br />Hong Kong SAR (China) / Taiwan (China)</button>
</div>
<div>
<button id="locationOther" type="button" class="btn">All other locations</button>
</div>
<div class="margin0">
<img src="/myMSC/Content/Images/download-mymsc-on-app-store.svg" alt="DOWNLOAD MYMSC ON APP STORE" />
<img src="/myMSC/Content/Images/download-on-google-play.png" alt="DOWNLOAD MYMSC ON GOOGLE PLAY" id="imgStoreGoogle" />
</div>
</div>
I just need to click the button with id = "locationOther", but I get errors using "link" and "selectButton" with no good results.
I hope someone can help me, thank you!
$buttonCrawler = $crawler->selectButton('Button text');

Can I have a form inside a site master in ASP.NET webforms

I am trying to insert a form into my site.Master but when I debug it, it seems to have removed the form.
<form onsubmit="quoteMe(event)">
<div class="form-group" id="divQuotePriceBeforeBook">
<button class="btn btn-block btn-primary" id="quotemebutton" type="submit">Quote Now</button>
</div>
</form>
I can see that there is a server form wrapping the entire body, does this mean we can't have forms?
No you cannot do that using WebForms but there is always a work around.
Based off of your code it doesn't seem like you need a form for what you are trying to accomplish.
<div class="form-group" id="divQuotePriceBeforeBook">
<button class="btn btn-block btn-primary" id="quotemebutton" onclick="quoteMe()">Quote Now</button>
</div>
If you really do need the code to post back to the server, you would want to do something like this:
<div class="form-group" id="divQuotePriceBeforeBook">
<asp:Button id="quotemebutton" runat="server" CssClass="btn btn-block btn-primary" OnClientClick="quoteMe()" Text="Quote Now" />
</div>

Laravel Form Button Cancel

Using Laravel, I have a form and I want to include a "cancel" button that just redirects back to a different route. Since the button is within the form element, when clicked it attempts to submit the form. In the Laravel docs I don't see a good way to do this. Any suggestions or would using Javascript be best?
Thanks,
<div class="form-group pull-right">
<button class="btn btn-default btn-close">Cancel</button>
<button type="submit" class="btn btn-global">Register</button>
</div>
Though it's a very late answer, But it might help others.
You can just redirect back where you have come from. Simply use the following code.
Cancel
It will send you back where you have came.
<a> elements in bootstrap can have the btn class and they will look just like a button, so you can take the button out and just have cancel be a link:
<div class="form-group pull-right">
<a class="btn btn-default btn-close" href="{{ route('home') }}">Cancel</a>
<button type="submit" class="btn btn-global">Register</button>
</div>
it does not have to do with laravel. You can simple use formaction attribute
<input type=submit formaction="anotherpage">
<button class="btn btn-default btn-close" formaction="{{ route('home') }}">Cancel</button>

Submit button in boostrap modal doesn't submit

I have an mvc generated form (#Html.BeginForm()) with button of type="submit" within bootstrap modal overlay.
<button aria-hidden="true" data-dismiss="modal" class="btn" type="submit">Close</button>
When I click the button - all it does is closes the modal.
Submit action (POST to the controller) is not performed.
You might have to remove the data-dismiss="modal" property since that triggers the Modal to close instead of doing a submit.
simply add <input type="submit" value="Close" class="btn" />
do this
#using(#html.BeginForm("ActionName","ControllerName"))
{
<input type="submit" value="Close" class="btn" />
}

Why does a Bootstrap modal not fire in a button, but only with Firefox?

I'm putting up a Bootstrap "split button" modal, which looks something like this:
<div class="btn-group">
<button class="btn btn-small btn-primary">
<a tabindex="-1" href="#" class="ajax-modal"
data-target="modal_vr-comment-form" data-backdrop="true"
data-controls-modal="res-modal" data-keyboard="true"
url="/some-url">Do the thing</a>
</button>
<button class="btn btn-small dropdown-toggle btn-primary" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right">
<li><a tabindex="-1" href="#" class="ajax-modal"
data-target="modal_vr-comment-form" data-backdrop="true"
data-controls-modal="res-modal" data-keyboard="true"
url="/some-url">Do the thing</a></li>
<li><a tabindex="-1" href="/comment/something-else">Do something else</a></li>
<li><a tabindex="-1" href="#" class="ajax-modal"
data-target="modal_unhide-people" data-backdrop="true"
data-controls-modal="res-modal" data-keyboard="true"
url="/comment/do-another-thing">Do another thing...</a></li>
</ul>
</div>
The thing of interest here is that the "Do the thing" action is presented in two ways: As an action to be taken when the main button is clicked, and as an action to be taken when an item in the dropdown menu is selected. These actions are set up as click handlers on the <a> tags in the split button, via some javascript init-ing.
Both actions work fine in Chrome and Safari. However, in Firefox, the action attached to the button does NOT fire, while the action attached to the link does. Some poking around during execution reveals that the click handler on the button is not firing, although it's definitely getting set up.
Any ideas out there about why this is (happening)? Thanks!
Found it, more or less: Twitter Bootstrap buttons are unresponsive in IE8 had a working approach. Instead of formatting the button as:
<button class="btn btn-small btn-primary">
<a tabindex="-1" href="#" class="ajax-modal"
data-target="modal_vr-comment-form" data-backdrop="true"
data-controls-modal="res-modal" data-keyboard="true"
url="/some-url">Do the thing</a>
</button>
do it as a pure <A> link with the appropriate button-style classes:
<a tabindex="-1" href="#" class=" btn btn-small btn-primary ajax-modal"
data-target="modal_vr-comment-form" data-backdrop="true"
data-controls-modal="res-modal" data-keyboard="true"
url="/some-url">Do the thing</a>
The appearance is identical, and it works fine in Firefox, IE, and Opera (both platforms). Whew.
I just had the same problem in 2019 (Bootstrap 4.3.1, Firefox Quantum 69.0) and found this post from 2011 that solved the problem for me: just remove the animation for the modal (remove the "fade" class from the parent div). Original post is here: http://chapter31.com/2011/10/27/twitter-bootstrap-modal-not-working-in-firefox/

Resources