Giter Site home page Giter Site logo

Comments (9)

DazzlingBob avatar DazzlingBob commented on September 22, 2024 2

I'm not in favor of removing p:resetInput.
The following construction is used a lot in our projects :

<p:commandLink title="Title"
  action="#{bean.doAction(data)}"
  update=":mainform:tabContainer:container :mainform:containerA :mainform:containerB :mainform:containerC"
  rendered="#{not empty data.id}"
  process="@this">
  <p:resetInput target=":mainform:tabContainer:container" />
</p:commandLink>

Only inputs in :mainform:tabContainer:container are reset.
Other containers like :mainform:containerA keep there input values, in our case often input search criteria with the search result as text. The search result can change though database transactions/bean.doAction.

The official JSF 2.2 definition of resetValues="true" is: "JSF resets all input components specified in the render attribute."
For example: <f:ajax render="field1" resetValues="true"/>

So:

<p:commandLink title="Title"
  action="#{bean.doAction(data)}"
  update=":mainform:tabContainer:container :mainform:containerA :mainform:containerB :mainform:containerC"
  rendered="#{not empty data.id}"
  process="@this"
  resetValues="true">
</p:commandLink>

Means all inputs of containers mentioned in "update" (in JSF: the render tag) will reset.
What is not correct in this situation.

When the tag p:resetInput is removed the only solution is to add in method bean.doAction:

PrimeFaces.current().resetInputs(":mainform:tabContainer:container");

Which is correct, but is less semantic/visible then a p:resetInput tag.

from primefaces.

melloware avatar melloware commented on September 22, 2024

@tandraschko i will have to check but we do this a lot to reset a Dialog before opening it which lives in another form.

<p:commandButton id="btnAdd" actionListener="#{pathDefinitionController.newEntity()}"
				value="#{appmsg['action.admin.add']}" title="#{appmsg['action.admin.add.hint']}" icon="fa fa-plus"
				styleClass="ui-admin-button" rendered="#{accessProvider.adminOwner}" immediate="true" update=":frmEntityDialog"
oncomplete="PF('editDialog').show();">
	<p:resetInput target=":frmEntityDialog" />
</p:commandButton>

I wasn't sure resetValues="true" handles this case so I guess we need to test it. cc @FlipWarthog

from primefaces.

tandraschko avatar tandraschko commented on September 22, 2024

in your case you can just remove p:resetInput and add resetValues=true, should work

from primefaces.

melloware avatar melloware commented on September 22, 2024

OK we will test it and report back.

from primefaces.

DazzlingBob avatar DazzlingBob commented on September 22, 2024

What about a programmatically reset like "PrimeFaces.current().resetInputs("form:panel")"?
Very unfortunate if that is not possible anymore.

from primefaces.

melloware avatar melloware commented on September 22, 2024

What about a programmatically reset like "PrimeFaces.current().resetInputs("form:panel")"? Very unfortunate if that is not possible anymore.

@DazzlingBob no i think its just removing the tag <p:resetInput> all else would remain i believe.

from primefaces.

tandraschko avatar tandraschko commented on September 22, 2024

Yeah
Only the tag

from primefaces.

melloware avatar melloware commented on September 22, 2024

I think we also do that @DazzlingBob which is why now i remember using p:resetInout to control only what gets reset not what gets also Updated.

from primefaces.

tandraschko avatar tandraschko commented on September 22, 2024

sounds valid
lets close

from primefaces.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.