Passing String Parameter to javascript function in jsp is not workingPassing String Parameter to javascript function in jsp is not workinghttps://liferay.dev/c/message_boards/find_thread?p_l_id=119785333&threadId=1213897682024-03-29T09:30:16Z2024-03-29T09:30:16ZRE: Passing String Parameter to javascript function in jsp is not workingGennaro Lippiellohttps://liferay.dev/c/message_boards/find_message?p_l_id=119785333&messageId=1213929302022-04-05T18:31:28Z2022-04-05T07:47:39Z<p>Hello, replace this</p>
<pre>
<code class="language-java"><% String data = "some data from database"; %>
javascript:onChangeCheckBox('<%= data %>')</code></pre>
<p>with</p>
<pre>
<code>${data = "some data from database"}
javascript:onChangeCheckBox('${data}')</code></pre>
<p> </p>Gennaro Lippiello2022-04-05T07:47:39ZRE: Passing String Parameter to javascript function in jsp is not workingKunal Bhangalehttps://liferay.dev/c/message_boards/find_message?p_l_id=119785333&messageId=1213930422022-04-05T18:30:38Z2022-04-05T05:24:02Z<p>Thanks for your answer issue is now resolved</p>Kunal Bhangale2022-04-05T05:24:02ZRE: Passing String Parameter to javascript function in jsp is not workingOlaf Kockhttps://liferay.dev/c/message_boards/find_message?p_l_id=119785333&messageId=1213927072022-04-04T19:38:59Z2022-04-04T19:38:59Z<p>If memory serves me right, having scriptlet in tags requires the
whole value to be a scriptlet.</p>
<p>E.g. instead of</p>
<pre>
<code class="language-java"><some:thing key="some <%="value"%>"/></code></pre>
<p>you'd need</p>
<pre>
<code class="language-java"><some:thing key="<%="some " + "value"%>"/></code></pre>
<p>or similar</p>Olaf Kock2022-04-04T19:38:59ZPassing String Parameter to javascript function in jsp is not workingKunal Bhangalehttps://liferay.dev/c/message_boards/find_message?p_l_id=119785333&messageId=1213897672022-04-04T16:37:51Z2022-04-03T06:30:45Z<p>I have one JSP file This file contains some below code.</p>
<pre>
<code><%
String data = "some data from database";
%>
<aui:input type="checkbox" name="isOption" label="isOption" onChange="javascript:onChangeCheckBox('<%= data %>');"></aui:input>
<script>
function onChangeCheckBox(input)
{
console.log("Input------------>"+input);
}
</script></code></pre>
<p>
<br /> <br /> <br /> When I have a checking or unchecked the
checkbox from UI it will call the onChangeCheckBox function and print
the input on the console.</p>
<p>But instead of printing the actual string, it will be printing the
below output on the console.</p>
<p>Input------------><%=