set session on the click of edit button in grocery crud - codeigniter

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.

Related

How to confirm a request by clicking a button

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

auto load registration form popup on checkout

i am working on oncepagecheckout, there is a link "Click here to login or create a new account", However we click on this link a popup of login form does display. but i want to display this login popup form should display automatically on page load, Kindly help
You can easily do that with jQuery. Just use below code, this will trigger a click onload of page. Just check the id of the button and replace that in the below code:
<script>
$(document).ready(function(){
$('#your_button_id').click();
});
</script>

How to Go Back on Cancel in Laravel

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

Cannot get past Modal dialog present (Selenium::WebDriver::Error::UnhandledAlertError)

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.

jQuery Mobile How to simulate data-rel="dialog"

Is there a way to simulate the data-rel="dialog" attribute to show a page as a dialog page?
I can't use this one because I use the button for the LogIn/LogOut model, and this one doesn't work if I don't insert the data-ajax="false" attribute.
But using this I cannot use the ajax-based data-rel attribute.
So I need a trick to create a dialog page without using the dialog attribute on the anchor link.
Thanks
Hopefully in the next iteration of jQM ( 1.2 ) you could use the Popup, You can currently test this out in the pre-release builds:
http://jquerymobile.com/test/docs/pages/popup/index.html
or a form login

Resources