I'm creating a laravel app whereby if user send a request you have to confirm by clicking a button. Which is the best method to implement that. Can somebody help me please.
If its a form request you can just add to the Button-Element a
onclick="return confirm('Are you sure?')" like so:
<button onclick="return confirm('Are you sure?')"> Send Request </button>
a Popup Window will ask you for confirmation
The best way to do this would be using JavaScript. You can easily achieve this with JQuery.
Have a look at this, I think this is what you need: form confirm before submit
Related
Sorry if it is a very basic question. But I would like to know how can I go back to the previous page if I click on the Cancel button in a form page.
The form page has a Submit and Cancel
On Submit, it goes to the route.php and gets the Route::post('', ''); section. What about the Cancel button with a name=cancel?
To go back on a button.
<button type="button" onclick="window.location='{{ URL::previous() }}'">Cancel</button>
Laravel 4
Cancel
I'm having trouble getting angularjs form validation to work in Chrome. I have a super simple example plunker that illustrates the issue. If you enter non-numeric data into the box and click the button, it still says the form is valid in Chrome. But if you do that in Firefox, it shows it as invalid which is what I would expect. What's going on here?
Thanks,
Andy
Looks like a bug with AngularJS and Chrome, try to add required to the input and it should work:
<input type="number" step="any" name="someNumber" ng-model="someNumber" required />
Here's a plunker to test it.
This is the open issue on AngularJS.
Is there any way to set session on the click of edit button, before or on the page load in grocery crud.
$crud->callback_before_update(array($this,'encrypt_password_callback'));
we are having this for call a method but it only works when i click update button,
my requirement is to call a method when the edit page loads.
Use javascript to simulate button click, here is simple example
<input type="checkbox" onClick="document.getElementById('theSubmitButton').click();">Check the box to simulate a button click
<br>
<input type="button" name="theSubmitButton" id="theSubmitButton" value="Button" onClick="alert('The button was clicked.');">
Or you can use jQuery
jQuery('#mydiv').click();
To make it work on links, I think you need to add an onclick handler and then redirect the page.
I'm using watir-webdriver and i'm having trouble with a confirmation popup. I click on a 'Sell' button and a confirmation popup appears. I can't seem to figure out how to come up with the step to click 'OK' on the popup. Any help would be much appreciated.
The html in question is: (Button)
<button>class="btn primary" onclick="return confirm('Are you sure you wish to sell the selected loan parts?');" value="Sell Loan Parts" name="sell_loan_parts" style="" type="submit"</button>
I tried using following step, but I guess this is incorrect:
#browser.button(:onclick, "return confirm('Are you sure you wish to sell the selected loan parts?');").click
Error message I recieve is:
Modal dialog present (Selenium::WebDriver::Error::UnhandledAlertError)
[remote server] file:///var/folders/fd/hjkxr06j6gs6620tl4k_9fh00000gn/T/webdriver-profile20121129-50930-ul24fl/extensions/fxdriver#googlecode.com/components/command_processor.js:10402:in `unknown'
Watir has an api for handling these types of javascript alerts. Some useful links:
Watir-Webdriver > Javascript Dialogs
Watir-Webdriver Alert API
You should be able to click OK in the confirm by doing:
#browser.alert.ok
Might also be of help to recall the browser to set focus to the modal window (when using Selenium Webdriver and Cucumber, for example). This has worked for me in the past when nothing else has. All you have to do is this:
browser = GemName::CucumberFormatter::Browser.get_browser
browser.alert.ok
It's just another option.
If I place, for instance, the following component and click it, it behaves as expected:
<h:commandLink value="Click me" action="anotherPage.jsf" />
But if I use Ajax:
<h:commandLink value="Click me" action="anotherPage.jsf"><f:ajax /></h:commandLink>
It doesn't navigate to the other page.
Am I missing something? Isn't this supposed to work?
Another issue is that, when I click a button that is using ajax after session timeout, the application redirects to the login page but it doesn't load css files.
Any ideas?
Kind regards,
Carlos Ferreira
You can do it if you send a redirect.
action="anotherPage.jsf?faces-redirect=true"
However, I completely fail to see the point/benefit of navigating using Ajax like that.
From my understanding ajax is used to update components of the current page and not to navigate to other pages.
If you have lots of ajax requests on your page then ajaxifying the command button's request mean's that all other validations (from other ajax requests) on the page will complete before navigation to the next page. Otherwise without the ajax request for the button the http request that it generates will blow away these other requests and just navigate directly to the next page without waiting for them to complete.