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

Uncaught TypeError: dom.getFieldValue is not a function #1436

Closed
wzup opened this issue Jul 2, 2017 · 10 comments
Closed

Uncaught TypeError: dom.getFieldValue is not a function #1436

wzup opened this issue Jul 2, 2017 · 10 comments

Comments

@wzup
Copy link

wzup commented Jul 2, 2017

A custom field of type="file" in an InsertModal throws an error. How to manage file uploads?

A field:

file - google chrome 2017-07-02 21 31 56

An error thrown by the plugin:

InsertModalBody.js:57 Uncaught TypeError: dom.getFieldValue is not a function
    at InsertModalBody.<anonymous> (InsertModalBody.js:57)
    at Array.forEach (<anonymous>)
    at InsertModalBody.getFieldValue (InsertModalBody.js:41)
    at InsertModal.__handleSave__REACT_HOT_LOADER__ (InsertModal.js:63)
    at InsertModal._this.handleSave (InsertModal.js:54)
    at InsertModalFooter.__handleSaveBtnClick__REACT_HOT_LOADER__ (InsertModalFooter.js:68)
    at InsertModalFooter._this.handleSaveBtnClick (InsertModalFooter.js:46)
    at Object.ReactErrorUtils.invokeGuardedCallback (ReactErrorUtils.js:69)
    at executeDispatch (EventPluginUtils.js:85)
    at Object.executeDispatchesInOrder (EventPluginUtils.js:105)

Real screenshot of component's code. 1) The method is never called. 2) It is never called whatsoever. Although the method exists in a component.

google chrome 2017-07-03 05 48 03

Method in a component:

google chrome 2017-07-03 05 55 22

@AllenFang
Copy link
Owner

AllenFang commented Jul 8, 2017

@wzup, sorry for lately reply, busy on my job..

If you have any custom editor in insert modal, the component of custom editor should implement getFieldValue method and return the value if input, check this

Let me know if the problems is still remain, thanks

@DarMontou
Copy link

There's some likely unexpected behavior when using a single custom insert modal field if the value of the field is falsy, and the getFieldValue method is undefined.

inputVal = inputVal || dom.getFieldValue();
::=> "" || dom.getFieldValue();
::=> dom.getFieldValue()
::=> Uncaught TypeError: dom.getFieldValue is not a function

@AllenFang
Copy link
Owner

HI @DarMontou, you mean if you return false in getFieldValue function then got above error ?

@justbill2020
Copy link

i'm also having an issue with this. dom.getFieldValue() not a function

@Strateus
Copy link

Strateus commented Oct 30, 2017

same here
and i defined getFieldValue method as in the example

@Strateus
Copy link

It seems issue is related to redux connect, it works without it

@solace
Copy link

solace commented Dec 9, 2017

Using the example provided:

customSaleField = (column, attr, editorClass, ignoreEditable) => {
  /*
    In this case, you are suppose to be prodived a specific method name for
    react-bootstrap-table to get the value for this field.

    Notes:
    1. You are suppose to be implement getFieldValue function and return the value that user input
  */
  return (
    <SalesRadioField ref={ attr.ref } editorClass={ editorClass } ignoreEditable={ ignoreEditable }/>
  );
}

attr.ref is undefined which appears to be contributing to why this error occurs.

Any suggestions?

@AllenFang
Copy link
Owner

@solace, it work well for me,

@solace
Copy link

solace commented Dec 13, 2017

Well, it doesn't seem to according to the other people above. :)

@solace
Copy link

solace commented Dec 13, 2017

In any case, I was able to resolve by overriding the insert modal body. Copied the original and made modifications to the ref for custom fields.

https://gist.github.com/solace/b5f1fc3f1f632cb79bccc63ed7f49d1d

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

6 participants