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

Jamie Sammons, geändert vor 2 Jahren. New Member Beiträge: 3 Beitrittsdatum: 24.12.23 Neueste Beiträge

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, geändert vor 2 Jahren. Liferay Master Beiträge: 593 Beitrittsdatum: 08.08.14 Neueste Beiträge

Hi ,

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

PortalUtil.clearRequestParameters(renderRequest);