Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form.ts line 42 is trying to retrieve faces.request.ajax.arguments #699

Closed
pizzi80 opened this issue Jun 21, 2022 · 8 comments
Closed

Form.ts line 42 is trying to retrieve faces.request.ajax.arguments #699

pizzi80 opened this issue Jun 21, 2022 · 8 comments

Comments

@pizzi80
Copy link
Contributor

pizzi80 commented Jun 21, 2022

this is not compatible with js strict mode

const params = faces.ajax.request.arguments;

I am creating a PR for mojarra's faces.js
and my PR will break it

I would like to know your thoughts on this

  1. Is there a way to fix this in Form.ts?
  2. port partialSubmit to Faces
  3. remove the strict mode from faces.js only for this
@BalusC
Copy link
Member

BalusC commented Jun 22, 2022

Just add new property to API such as faces.ajax.request.params.

@pizzi80
Copy link
Contributor Author

pizzi80 commented Jun 22, 2022

In the meantime I'm trying to test the o:form partialSubmit
but it doesn't seems to work as expected
(does it should work like PrimeFaces partialSubmit?)

with Faces 4 / Omnifaces 4 the following form creates a full form ajax submit

<o:form id="partial" partialSubmit="true">
    <h:inputText id="name" value="#{testBean.name}" />
    <h:inputText id="foo" />
    <h:inputText id="foo2" />
    <h:inputText id="foo3" />
    <h:commandButton id="action" value="submit" action="#{testBean.action}" >
        <f:ajax execute="name" />
    </h:commandButton>
</o:form>

Schermata da 2022-06-22 15-34-43

@BalusC
Copy link
Member

BalusC commented Jun 22, 2022

Crap, it regressed during ee76f78. I'll have to fix it and add an IT.

@pizzi80
Copy link
Contributor Author

pizzi80 commented Jun 23, 2022

wow, I didn't think you would fix the bug right away, so in the meantime I was working on it ... :D

I'm trying to introduce the partial submit directly inside faces.js and I think
that the final place is inside faces.ajax.getViewState
... but it should be approved first ... at the moment I'll keep it in my fork ...

the main question is: "Why partial submit is not the default and only algorithm?"

@BalusC
Copy link
Member

BalusC commented Jun 23, 2022

It has to be specified in API first. But in Mojarra impl for example you can keep it experimental and by default disabled.

Note that the InputHiddenIT has failed since the bugfix. I still need to look at these when I have time. Basically the algorithm needs to be fixed in such way that any non-namingcontainer child also needs to be included.

BalusC added a commit that referenced this issue Jun 23, 2022
BalusC added a commit that referenced this issue Jun 23, 2022
@BalusC
Copy link
Member

BalusC commented Jun 23, 2022

InputHiddenIT has been fixed.

Coming back to the original question, I'll have to take back my first comment. This is in hindsight not that trivial. Your best bet is to change the signature of the faces.getViewState(form) function to support a second argument representing options.execute. This will also give the actual implementation (be it Mojarra or MyFaces) the opportunity to correctly perform the "partial submit" feature even when merely experimental.

@BalusC
Copy link
Member

BalusC commented Jun 23, 2022

I've solved it by simply also monkeypatching the jsf/faces.ajax.request itself.

@pizzi80
Copy link
Contributor Author

pizzi80 commented Jun 23, 2022

InputHiddenIT has been fixed.

Coming back to the original question, I'll have to take back my first comment. This is in hindsight not that trivial. Your best bet is to change the signature of the faces.getViewState(form) function to support a second argument representing options.execute. This will also give the actual implementation (be it Mojarra or MyFaces) the opportunity to correctly perform the "partial submit" feature even when merely experimental.

today I was working on it and I came to same conclusion!! 😅

DSC_8912

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants