Skip to content Skip to sidebar Skip to footer

Gsp, Groovy, Encodeuri Component, Inline Javascript

i have a problem with this each loop i have a select, you choose an option, press a button and the selected value is beamed via ajax as encodeURIcomponent to the backend, the answe

Solution 1:

Of course this breaks when ${it} contains ", because this effectively means that the value of your onclick attribute gets terminated where the second " occurs.

encodeURIComponent can of course not help you here, because it “comes too late” – you can not call a JavaScript method to fix broken HTML code.

What you want is to have the " rewritten to " – so that it does not end the attribute value. For which method does that in your template language – please consult docs.

Post a Comment for "Gsp, Groovy, Encodeuri Component, Inline Javascript"