Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    JavaScript


Advertisements:










Jquery :: Grails - Submit To Controller / Action On Select Change


I would like to submit a form to an action on select box change (when an item is selected I need to update another select box and maybe other fields). The following code will submit the form to the controller/action defined on form element. <g:select onchange="submit()"/>

How could I submit the form to a custom action ? I think to put a hidden action submit on the page and trigger a click on it when selecting an item in the select box, but hopping there is a more elegant way. The project use jquery, so the prototype library isn't available.


View 1 Replies (Posted: Nov 17 at 20:26)

Sponsored Links:

Related Forum Messages For JavaScript category:
Jquery :: Pass A Multi-select Array Of Values To Mvc3 Controller Action Via $.get?
How do I send back an array of values back to a controller action via $.get?I have tried (string[] values) and (List).

...
var val = $('#CStatus').val(); // Get a list of selected values
alert(val); // Displays 0,1

[code]....

Posted: Dec 9 at 4:10

View 2 Replies!   View Related
Jquery :: Using The Output From G.render In Grails Controller?
I am rendering two GSP templates in a controller. The first template is rendered as follows: String couponspage = (g.render(template: "availableCoupons", contentType:"text/html", model : [:]))?.toString()

I include the results of the first template in the model to the call to render the second template as follows:

render(template: "itemOffer", model: [merchantOffers: merchantOffers, asinnumbers: params.asinnumbers, linkshare : couponspage])

In the second GSP template, I use jQuery to update the contents of an element using the rendered template contained in the model as follows:

$("#elementid").html("${linkshare}")

Everything works if the rendered-template has all html elements on a single line.Unfortunately, my GSP template like many other html documents have tabs and newline characters to make the file readable by humans. g.render includes these control characters which seems to cause everything to break. A simple file that has Hello World contained in a paragraph element contained in a div element doesn't work.

(Sorry you can't see the paragraph and div elements in the above example.) The documentation suggest that what I am doing is straight forward and should work with no problem. I can't believe I have to strip the control characters from the rendered string or do I. Removing the call to jQuery and adding "${linkshare}" directly to the end of the second template also works. What gives?

Posted: Sep 10 10 at 1:11

View 1 Replies!   View Related
Possible To Pass Script Variable Value To A Grails Controller?
I have found the following javascript code to get browser window size [code]...

Posted: Dec 14 10 at 17:28

View 3 Replies!   View Related
Jquery :: @{Controller.action()} Usage In Files - Action-calls To Play Controllers
I'm building a webapp with jQuery, which is using many $.get(..) and $.post(..) action-calls to my Play Controllers. Example:

$.get('@{Patients.activeEpisodes()}', function(data) {
$('#secondary').append(data);
});

When I create a javascript function directly in my template file, the @{Controller.action()} tags are correctly replaced with the correct url. But when i put the same function inside a seperate .js file which is imported in the template using the #{script 'myJavaScriptFile.js' /} tag, these @{xxx} tags are not repalced with the correct Url's. Is there a way to have these tags properly replaced by the templating enginge?

Posted: Aug 30 11 at 16:03

View 1 Replies!   View Related
Assign A List Of Objects From Grails Controller To Array?
I am passing a list of objects from my controller to my page , on loading of my page i want to invoke a javascript function on each of the element in the list coming from the controller .. HOW can i achieve that , i know i cannot mix and match javascript and ${}(g-strings) ,

code: from controller , the DurationTable contains expiry a date field in itself

def test = {
[durationTablelist: DurationTable.list()]
}

code on gsp ::

jQuery(document).ready(function() {
var counter = 0;
var myarraylist = new Array();
myarraylist = "${durationTablelist}";

[Code]....

Posted: Aug 1 11 at 13:18

View 2 Replies!   View Related
Action Url Change On Submit Form
Is it possible to change URL form action on submit form...

I have tried such code:

<script language="JavaScript" type="text/javascript">
function changeURL()
{
......

Posted: May 23rd, 2007

View 1 Replies!   View Related
Change Action From Submit To ImageField?
I found this free script that I want to use on my order form (disables order button until agreed to terms by clicking checkbox). It is working, but I would like to use an image.gif-button instead of a Submit-button.

Would be grateful if someone could explain how to change in the script from "disable Submit-button"-action to "disable image.gif-button"-action. I've tried to do it myself, but I don't know much about Javascript, and couldn't get it to work.

My 2nd question: Can this type of action only be done in Javascript, or could there be a solution whereby the checkbox on the html-page calls a php-page to get the same type of validation?

The script:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Checkbox Form Validation</title>
<script type="text/javascript">

[Code]...

Posted: Jan 4, 2010

View 2 Replies!   View Related
Php - Change A Form Action Upon Submit?
Basically I have a form with a few drop-downs, but the page I'd like to be set as the action of the form submit would be based on the option chosen in one of the drop downs. I'd like to stick with one submit button, so it seems a little tricky.

Posted: Sep 22 11 at 13:34

View 2 Replies!   View Related
Change Form And Action And Then Auto-Submit?
I have a body onload doing multiple things, changing a select option value, changing the form submit action and then auto submitting. Everything works fine until the auto submit part of it.

function run()
{
document.myform.myselect.selectedIndex = 1;
document.myform.action = 'page.php?x=1&y=2';
document.myform.submit();
}
<body onload="run()">

Posted: 11-09-2011, 03:55 PM

View 2 Replies!   View Related
Ajax :: Redirect User In Grails If Browsing An Action
I have a Grails controller action that is used for Ajax purposes, though you can still navigate and view the page in the browser.

class QuoteController {
def quoteService
/**
* This page uses the ajaxRandom function defined below to display random quotes.

[Code]....

Is there a way to redirect if someone visits the URL via browser while maintaining the method's Ajax functionality from within a page?

Posted: Oct 22 09 at 2:50

View 3 Replies!   View Related
Url.Action Only Render Controller And Action But Not Id?
I need to render a URL for a JavaScript search that I am doing. Unfortunately Url.Action renders not only the action but the current id. This occurs when presently on page utilizing the action with the id.To illustrate Url.Action("List", "Org"); will first render Org/List from which I can append an org to be listed. However, after the location has been moved to Org/List/12345 Url.Action("List", "Org"); will render Org/List/12345 and appending to that creates an issue where I end up with Org/List/12345/6789.Is there a different method I can use other than Url.Action? I've thought about using JavaScript to check for the number of / and removing part of the string but that seems a bit hackish.

// appears in my Site.Master & utilizes the AutoComplete plugin for jQuery
$(document).ready(function() {
$("input#FindOrg").autocomplete('<%= Url.Action("Find", "Org") %>', {

[code].....

Posted: Jan 18 10 at 19:19

View 2 Replies!   View Related
Ajax :: Grails / Dojo Progress Bar Getting Progress From Controller / Service
I'm using Grails to create a web-based data loading application that in short, takes an excel sheet of arbitrary rows and runs them through a backend system to prep the data for testers.Everything is working fine, but the last thing I need is some method to inform the user (especially on LARGE data files) of how many rows of data it has processed. If there's more than 200 rows, the app will (appear) to time out even though its still chugging along. This is a problem because it's very likely the user will reload the file and mess up processing... duplicate test data rows will cause a bunch of downstream issues.

What I can't seem to figure out is the correct way to call the method to get the percentage to link to the progress bar.(replacing the boilerplate progress code.)I know Java well enough but getting this to work just seems a little mystifying.I'm willing to entertain ANY idea of getting progress out there whether or not its technically best-practice.I'm to the point where I just need SOMETHING to display this information.It doesn't have to be dojo, it's just the direction that I had the most initial success with.

Posted: Sep 30 11 at 15:41

View 2 Replies!   View Related
Call Submit Action Using SimpleFormController Of Spring But Action Calling Only HandleRequest But Its Not Calling The Onsubmit Action?
I am trying to call submit action from javascript using simpleFormController of Spring but action calling only handleRequest but its not calling the onsubmit action

Posted: Feb 1 10 at 10:34

View 1 Replies!   View Related
Grails: Add Value Of Two G:select To A HTML Multiple Select List?
I have two g:select comboboxes that I want to add to the multiple select list when clicking an image.Here is the function in javascript:

function addToList(list,firstOpt, secOpt)
{
var y = document.createElement('option');

[code]....

Posted: Sep 29 10 at 15:01

View 1 Replies!   View Related
Jquery :: Asp.net Mvc - MVC Go To Controller Action?
In Jquery, I need to tell the program to go to EmployeeController and Empl action. How do I tell it do this. I want to simple way to do this without using ajax.

Posted: Nov 30 11 at 20:50

View 3 Replies!   View Related
JQuery :: .net MVC2 Can't Invoke Action From Controller?
I've followed examples which I've found in net but I have stuck I have img element on my page to which I'm trying to add via jQuery click event and then invoke action from my controller.

My Page

<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
<h2>About</h2>
<p>
Put content here.
</p>

[Code]....

I've tried many combinations and many examples but result is allways the same I'm Using visual web developer 2010 express

Posted: Nov 13 10 at 18:23

View 2 Replies!   View Related
Ajax :: Asp.net Mvc 3 Calling A Controller's Action Using Either Jquery?
I have a problem calling an action using javascript. So, I calculate a distance between two latitudes and longitudes. Now, If that distance is greater than 100 miles I want to call "distant" action in home controller that would return different view, but if it's less I would like to stay with index action.

Posted: Jul 27 11 at 19:19

View 1 Replies!   View Related
Jquery :: Mvc - Access Controller Action Result?
I am writing a code for multilevel menu. Main menu ie first level menu is loadedin page load. Upon clicking the item in the main menu sublevel menu are created. Items in the sulevel menu is created by action result in controller.Since it is n level submenu I am using jquery to populate submenu. Following is the code of main menu, which is a simple list

[Code]...

Posted: Sep 9 at 5:22

View 1 Replies!   View Related
JQuery :: Asp.net Mvc 3 - Ajax Does Not Call Action In Different Controller?
I m in a situation where i need to call a action method of different controller

I mean I am currently in controller 'Wk' action -History's On this view when i click any link then an ajax call will call the action method of different controller. But the ajax call calls the action method of the same controller.

the jquery is -

$.get("History/20/5/2", function (data) {
$("div#dShow").html(data);
$("div#dShow").dialog({
opacity: 0,

[Code].....

Posted: Nov 23 11 at 9:28

View 1 Replies!   View Related
Jquery :: Rails 3: Run Controller Action From Js File?
I would like to click a div on a page to run a certain number of javascript tasks, but also to run an action on a controller. To explain in greater detail: I have a untitled.js file in which I have put a bunch of jquery code :

[Code]...

Posted: Jul 21 11 at 18:49

View 1 Replies!   View Related
JQuery :: AJAX Load Not Executing On ASP.NET MVC Controller Action / Fix It?
I have a simple thing going here: two divs and two calls to load partials (controller actions with PartialView as results).

I am dealing with two controller actions: Index and ItemDetail. The jQuery load works in the view returned by the Index action, but not on ItemDetail.

These items are in the same controller and you can access them in a brower as follows code...

To isolate the problem, I have set up Index and ItemDetail to return views with identical syntax code...

The .load methods fire and load the appropriate partial views for index, but not for ItemDetail.

I think the only thing different is the route. In fact, if I return the 'detail' view in the index it renders correctly and the jQuery runs, and if I return the 'index' view in the controller action for itemDetail it renders the page but never executes the jQuery.

Any ideas?I have a simple thing going here: two divs and two calls to load partials (controller actions with PartialView as results).

I am dealing with two controller actions: Index and ItemDetail. The jQuery load works in the view returned by the Index action, but not on ItemDetail.

These items are in the same controller and you can access them in a brower as follows code...

To isolate the problem, I have set up Index and ItemDetail to return views with identical syntax

Posted: Jan 12 10 at 15:43

View 2 Replies!   View Related
Ajax :: Refresh Rails Controller Action And Div Using JQuery?
I have a div with a jquery video-player and a hidden div with a link of video for this player. The link is configured by current controller's action and by refreshing it, we will have another link for the player. Is there a way, to refresh video-player div and controller, without refreshing the page? I know, that such function should be handled with ajax, but just couldn't figure anything up. Should I render a separated link-action, called by ajax, on the page and then refresh the player div and link action? In which way should i look?

Posted: Feb 15 11 at 2:01

View 1 Replies!   View Related
Jquery :: Reload Kohana Controller/action Using Ajax?
In Kohana 3.1 how do you use ajax (with jquery) to reload a contollers action and then update the relevent content in the view?

e.g. I would like a controller /classes/controller/user.php with the action public function action_bio() { ... } to display a grid of 3 user avatars (user1 - user3), and fetch the user biography from db and displays it inside #content div of the user provided by the id parameter in the url (routed to default as user1). Each avatar is a link to the relevent user biography i.e. href="/user/bio/user3".

I would like the switching of the biography to be asynchronous so when an avatar is clicked I would like to use jquery to prevent default event and then re-run action_bio - passing it the new user id parameter. I then want to replace #content with the new biograpahy action_bio outputs.

Posted: Mar 8 at 16:37

View 1 Replies!   View Related
Jquery :: Call Controller Action From Application.js File?
Essentially, it triggers callbacks when an element from the dropdown list is selected. As of now, it only adds the selected element to the text field. I want both the field to be populated and for my application to send a POST request to the video update controller action, so that the user does not need to explicitly press the button. How can I do this?

Posted: Apr 1 11 at 8:07

View 2 Replies!   View Related
Copyright 2005-08 www.BigResource.com, All rights reserved