Quantcast

Done

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Done

manuzi1
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Greetings from Austria,
Manuel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help with jQuery

Jonathan Rosenberg
Manuel,

It sounds like you are missing a basic understanding of how the pieces
fit together, and how jQuery works.

Why don't you start with something simpler, like a basic HTML page on
which you can get some familiarty with jQuery?

Then you can introduce Grails.

--
Jonathan Rosenberg
Founder & Executive Director
Tabby's Place, a Cat Sanctuary
http://www.tabbysplace.org/


On Wed, Jun 6, 2012 at 9:51 AM, manuzi1 <[hidden email]> wrote:

> Hello guys,
>
> I need help with jQuery. I didn't get it. What I want is that when i click a
> Checkbox or a Radio Button, some textfields appears, but I don't get it.
>
> I have a "page1.gsp" and in this page one I am render the template
> "temppage.gsp". In the temppage I have a Checkbox, when the Checkbox is
> Checked some textfields should appear ander the textbox.
>
> Now my questions:
>
> When I want to use jQuery I have to use <g:javascript library="jquery" /> in
> the <head> tag of the "page1.gsp". Am I right?
> Now I want to hide the things in the "temppage" under the checkbox. For
> example it is a <div> with the id test so <div id=test>. Right?
>
> And now how I can select the div tag in the temppage frome page1? In the
> tutorials it always starts with $(document), but I need to select my
> template or? Should I write this also in the <head> tag?
>
>
> or ist this wrong and I need <g:script>? Well, nothing works :D :(
>
>
> -----
> Greetings from Austria,
> Manuel
> --
> View this message in context: http://grails.1312388.n4.nabble.com/Help-with-jQuery-tp4629659.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help with jQuery

Müller, Wolfgang
+1

I hope I do not offend you, but I have some experience with students who often are unclear about when stuff is generated, when a request is made etc.

What you roughly describe, you can achieve it with jquery without firing a single request. Or you could do some jquery that sends a request to an controller/action in grails to give you back a piece of html (via a gsp) that you then render, or some JSON for that matter. Or, you could start out by having only plain classical "you-click and this causes a request" type of interaction, in which each click causes a full GSP page to render.

Especially for the first case, but also for the second, what JR suggests is the way to go. Nothing is more lightweight than a HTML page in a folder. You get that working first, and then you can migrate to Grails where you then can use the grails possibilities to extend.

I hope this helps and I did not misunderstand anything.
Best,
Wolfgang

On Wed, Jun 6, 2012 at 9:35 PM, Jonathan Rosenberg <[hidden email]> wrote:
Manuel,

It sounds like you are missing a basic understanding of how the pieces
fit together, and how jQuery works.

Why don't you start with something simpler, like a basic HTML page on
which you can get some familiarty with jQuery?

Then you can introduce Grails.

--
Jonathan Rosenberg
Founder & Executive Director
Tabby's Place, a Cat Sanctuary
http://www.tabbysplace.org/


On Wed, Jun 6, 2012 at 9:51 AM, manuzi1 <[hidden email]> wrote:
> Hello guys,
>
> I need help with jQuery. I didn't get it. What I want is that when i click a
> Checkbox or a Radio Button, some textfields appears, but I don't get it.
>
> I have a "page1.gsp" and in this page one I am render the template
> "temppage.gsp". In the temppage I have a Checkbox, when the Checkbox is
> Checked some textfields should appear ander the textbox.
>
> Now my questions:
>
> When I want to use jQuery I have to use <g:javascript library="jquery" /> in
> the <head> tag of the "page1.gsp". Am I right?
> Now I want to hide the things in the "temppage" under the checkbox. For
> example it is a <div> with the id test so <div id=test>. Right?
>
> And now how I can select the div tag in the temppage frome page1? In the
> tutorials it always starts with $(document), but I need to select my
> template or? Should I write this also in the <head> tag?
>
>
> or ist this wrong and I need <g:script>? Well, nothing works :D :(
>
>
> -----
> Greetings from Austria,
> Manuel
> --
> View this message in context: http://grails.1312388.n4.nabble.com/Help-with-jQuery-tp4629659.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help with jQuery

Mohamed Seifeddine
var allCheckboxes = jQuery("input[type=checkbox]")
var checkbox    = jQuery("#myCheckboxId");

OnOfTheVarsDeclaredAbove.click(function() { 

var checkbox = jQuery(this);

... 

checkbox.preventDefault();

})

If your checkbox is not fetched through ajax the above should work, if not, when the checkbox comes in, you need to make sure the code above runs on that specific checkbox. 

// Mo

On Wed, Jun 6, 2012 at 9:46 PM, Müller, Wolfgang <[hidden email]> wrote:
+1

I hope I do not offend you, but I have some experience with students who often are unclear about when stuff is generated, when a request is made etc.

What you roughly describe, you can achieve it with jquery without firing a single request. Or you could do some jquery that sends a request to an controller/action in grails to give you back a piece of html (via a gsp) that you then render, or some JSON for that matter. Or, you could start out by having only plain classical "you-click and this causes a request" type of interaction, in which each click causes a full GSP page to render.

Especially for the first case, but also for the second, what JR suggests is the way to go. Nothing is more lightweight than a HTML page in a folder. You get that working first, and then you can migrate to Grails where you then can use the grails possibilities to extend.

I hope this helps and I did not misunderstand anything.
Best,
Wolfgang


On Wed, Jun 6, 2012 at 9:35 PM, Jonathan Rosenberg <[hidden email]> wrote:
Manuel,

It sounds like you are missing a basic understanding of how the pieces
fit together, and how jQuery works.

Why don't you start with something simpler, like a basic HTML page on
which you can get some familiarty with jQuery?

Then you can introduce Grails.

--
Jonathan Rosenberg
Founder & Executive Director
Tabby's Place, a Cat Sanctuary
http://www.tabbysplace.org/


On Wed, Jun 6, 2012 at 9:51 AM, manuzi1 <[hidden email]> wrote:
> Hello guys,
>
> I need help with jQuery. I didn't get it. What I want is that when i click a
> Checkbox or a Radio Button, some textfields appears, but I don't get it.
>
> I have a "page1.gsp" and in this page one I am render the template
> "temppage.gsp". In the temppage I have a Checkbox, when the Checkbox is
> Checked some textfields should appear ander the textbox.
>
> Now my questions:
>
> When I want to use jQuery I have to use <g:javascript library="jquery" /> in
> the <head> tag of the "page1.gsp". Am I right?
> Now I want to hide the things in the "temppage" under the checkbox. For
> example it is a <div> with the id test so <div id=test>. Right?
>
> And now how I can select the div tag in the temppage frome page1? In the
> tutorials it always starts with $(document), but I need to select my
> template or? Should I write this also in the <head> tag?
>
>
> or ist this wrong and I need <g:script>? Well, nothing works :D :(
>
>
> -----
> Greetings from Austria,
> Manuel
> --
> View this message in context: http://grails.1312388.n4.nabble.com/Help-with-jQuery-tp4629659.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help with jQuery

manuzi1
This post was updated on .
In reply to this post by Müller, Wolfgang
CONTENTS DELETED
The author has deleted this message.
Greetings from Austria,
Manuel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help with jQuery

suryazi
As of Grails 2.0 Prototype is no longer the default JavaScript library (jQuery is used instead). You need to install Prototype Plugin.
manuzi1 wrote
Hm, thanks for the answers. I mean I read into jQuery and yui know. I tried some tutorials with normal HTML pages. And I also tried the Grails "Tutorial" from the book The definitive guide to grails the chapter "Ajax in Action". But this won't work. I mean it is pretty simple: Fill in the in the head tag and then make a remoteLink Show the time!
id="time>
In the controller the showTime with the following: render "The time is ${new Date()}" Well when i click on it a new page is loading with The time is ..... It doesn't work as "prototype", as "yul" (I installed it) and as jquery. Edit: This is was the source code says: <a href="/oracletestdb/myproj/showTime" onclick="YAHOO.util.Connect.asyncRequest('POST', '/oracletestdb/myproj/showTime', {success: function(o){YAHOO.util.Dom.get('time').innerHTML = o.responseText;}, failure: function(o){}}, '');return false;" action="showTime">Show
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help with jQuery

manuzi1
Oh thank you!
Unfortunately it does not change anyting. When i click the remoteLink, proj/controller/showTime appears.
Greetings from Austria,
Manuel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help with jQuery

suryazi
By the way did you uninstall the other libraries like Jquery and YUI prior to installing Prototype Plugin.
manuzi1 wrote
Oh thank you! Unfortunately it does not change anyting. When i click the remoteLink, proj/controller/showTime appears.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help with jQuery

manuzi1
No I didn't. Is there a conflict?

I tried it first with jquery because it was installed automatically with STS and Grails plugin or so. That didn't work, so I tried the prototype (recommended by the book) and yui (also recommended by the book)
Greetings from Austria,
Manuel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help with jQuery

Mohamed Seifeddine
What book? jQuery is the way to go, forget about prototype ;) 

On Mon, Jun 11, 2012 at 1:39 PM, manuzi1 <[hidden email]> wrote:
No I didn't. Is there a conflict?

I tried it first with jquery because it was installed automatically with STS
and Grails plugin or so. That didn't work, so I tried the prototype
(recommended by the book) and yui (also recommended by the book)

-----
Greetings from Austria,
Manuel
--
View this message in context: http://grails.1312388.n4.nabble.com/Help-with-jQuery-tp4629659p4629890.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help with jQuery

Scott6666
2-3 years ago prototype was a leading solution and the JavaScript framework bundled with Grails. That's also when all the grails books were written. So you would encounter that notion from them. Since then, jQuery has really rocketed into the lead for grails and non-grails applications so that's what you should learn and use. 



On Jun 11, 2012, at 8:06 AM, Mohamed Seifeddine <[hidden email]> wrote:

What book? jQuery is the way to go, forget about prototype ;) 

On Mon, Jun 11, 2012 at 1:39 PM, manuzi1 <[hidden email]> wrote:
No I didn't. Is there a conflict?

I tried it first with jquery because it was installed automatically with STS
and Grails plugin or so. That didn't work, so I tried the prototype
(recommended by the book) and yui (also recommended by the book)

-----
Greetings from Austria,
Manuel
--
View this message in context: http://grails.1312388.n4.nabble.com/Help-with-jQuery-tp4629659p4629890.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help with jQuery

suryazi
In reply to this post by manuzi1
In my opinion, you start a new project, uninstall the jQuery and then install prototype plugin and try the example from the book. I am hopeful that it should work.

By the way I fully agree with the forum that jQuery rocks!!!
manuzi1 wrote
No I didn't. Is there a conflict? I tried it first with jquery because it was installed automatically with STS and Grails plugin or so. That didn't work, so I tried the prototype (recommended by the book) and yui (also recommended by the book)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help with jQuery

manuzi1
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Greetings from Austria,
Manuel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Help with jQuery

Mohamed Seifeddine
Your missing a dollar sign ;    ('p#showit').show(); 

On Wed, Jun 13, 2012 at 12:29 PM, manuzi1 <[hidden email]> wrote:
But when it is an old method, i would like to learn the new one. I read in in
jQuery now... The way it should work in Grails should be rly easy. But it
doesn't work.

I made a new project and wrote a simple script which should hide a <p> tag
*and it works*.
So there must be something with the path or so. But ok, i made a new project
and copied it over. :) And now it works passably.

Here is my example:

<html>
<head>
 <g:javascript library="jquery" />

               <g:javascript>
                       $(document).ready(function()
                       {
                               $('p#showit').hide();
                               $('#linkme').click(function()
                               {
                                       ('p#showit').show();
                               });

                       });
               </g:javascript>
</head>
<body>
               <g:checkBox name='testing' id='linkme'/>
               <p id='showit'>
                       i am coming
               </p>
</body>
</html>

So the <p> tag is gone when I am running it, but when I click the checkbox
the <p> tag doesn't appear.

And another question: Normaly you have $('p#idHere') to chose the correct
tag with the id.
How is this with g: tags? Or does it only run with $('#idHere')?

And is it normal, that STS underlines the id's in the script tag?

-----
Greetings from Austria,
Manuel
--
View this message in context: http://grails.1312388.n4.nabble.com/Help-with-jQuery-tp4629659p4630042.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Loading...