0

any idea for this

var elemVal = $("#element").val();
var finalVal = "${someTagLib(attr: elemVal)}";

The element is a select option, so I am getting the value that the user selected to pass into a taglib function. It seems that search isn't being passed into the taglib. Anyone have a suggestion?

1 Answer 1

1

This is not possible at all. You are trying to mix server side code with client side code which is a common mistake.

When you use gsp's they first compiled on server i.e. in JVM, but there javascript can not be executed. Similarly when compiled gsp content is rendered as html in the browser, there will be no ${} since that is an groovy expression.

So the thing you are trying to achieve is not possible.

Sign up to request clarification or add additional context in comments.

2 Comments

thank sir, I'm doing another way by using a remoteFunction then call tagLib in controller and pass them to gsp element
Okay. avoid using grails ajax tags like remoteFunction etc. since they are already deprecated and going to be removed in future release. So writing your own jQuery code will help in long run.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.