views:

149

answers:

1

I have a Liferay portlet param "cmd" in my JSP page, which is initialized to a value "update". I need this value to be get changed to "delete", when a user clicks on the delete button of the form. How I can go about it?

<liferay-portlet:actionURL varImpl="edit_survey_form_action">   
<portlet:param name="cmd" value="update" />

<input class="optsurvey-submit" type="submit" name="submitButton" value="Delete" onclick="??????"/>

A: 
  1. Open the page in webbrowser.
  2. Rightclick page and choose View Source (or something similar, depending on browser used).
  3. Investigate the generated HTML code.
  4. Write JavaScript code accordingly based/targeted on the generated HTML code.

You should and must now realize that JavaScript knows nothing about the server side code :) It runs at the client side only. The JSP code is thus pretty irrelevant when writing JavaScript code (unless you can tell from top of head how the final HTML output will look like). Just concentrate on the generated HTML code, simply because that's the only what JavaScript actually can see and access. For more background information and hints you may find this artcile useful.

BalusC