RE: Forms are binding because their inputs have the same names. Help.

Jamie Sammons, modified 2 Years ago. New Member Posts: 3 Join Date: 12/24/23 Recent Posts

I have to identical forms in an MVCPortlet. But both are in different .jsp files

This is a rought structure of the forms.

<aui:form action="actionURL" name="crud_form">
    <aui:input name="id"/>
    <aui:input name="name"/>
<aui/form>

Both have the same actionURLs, but different names.

For some reason, whatever value is in the first form it gets autofilled into the second form.

For example, if in the first form I have id = 1 and name = foo, and then I submit. In the second form which is on the next page will have id = 1, and name = foo.

Even if I try to set the values from the .jsp files by setting value="another value", it gets overwritten. I tried using model-context and in both cases this still happends. I tried using different ids for each input, but it still happens.

Sorry, if I am not clear enpugh. Thanks

thumbnail
Mohammed Yasin, modified 2 Years ago. Liferay Master Posts: 593 Join Date: 8/8/14 Recent Posts

Hi ,

You can try using below method for clearing request parameters in your action method: 

PortalUtil.clearRequestParameters(renderRequest);