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

Setting defaultValue still shows hint/floatingLabelText #21

Closed
sys13 opened this issue Nov 3, 2015 · 10 comments
Closed

Setting defaultValue still shows hint/floatingLabelText #21

sys13 opened this issue Nov 3, 2015 · 10 comments

Comments

@sys13
Copy link

sys13 commented Nov 3, 2015

I'm trying to show a defaultValue. However, if hintText or floatingLabelText is set they will overlay over the defaultValue.

Using these versions:

"material-ui": "0.13.1",
"formsy-react": "0.17.0",
"formsy-material-ui": "0.2.4",
@mbrookes
Copy link
Collaborator

mbrookes commented Nov 3, 2015

@vijayrawatsan - looks like this was introduced in 0.2.3, and remains in 0.2.4. Could you take a look please when you get a chance? Thanks.

@vijayrawatsan
Copy link
Contributor

@sys13 how are you setting defaultValue can you give me an example. I will try that example with 2.2 2.3 and 2.4.
Will try to figure out what changed. Can't commit to work on this asap as I am running on some deadlines. But will surely run this on my background thread 😉

@mbrookes
Copy link
Collaborator

mbrookes commented Nov 3, 2015

Something like:

<FormsyText
  name='url'
  validations='isUrl'
  validationError="Please provide a valid URL"
  defaultValue="http://"
  hintText="http://www.example.com"
  floatingLabelText="URL" 
/>

mbrookes added a commit that referenced this issue Nov 5, 2015
@mbrookes
Copy link
Collaborator

mbrookes commented Nov 5, 2015

Hi Daniel, Please could you try the version in this branch: https://github.com/mbrookes/formsy-material-ui/tree/textfield-dafaultValue ?

You will need to use <FormsyText value="Default value" />.

Formsy and Material-UI use value to mean different things, and the Formsy mixin expects the default value to be on the value prop, not defaultValue. Hope this sort out the issue for you!

(Edit: although I'm not sure why the MUI Textfield wasn't rendering correctly given that defaultValue was already being passed down through the ...props spread.)

Vijay, any thoughts?

@sys13
Copy link
Author

sys13 commented Nov 5, 2015

Sorry, how do I run this locally?

@mbrookes
Copy link
Collaborator

mbrookes commented Nov 6, 2015

Like this: https://docs.npmjs.com/files/package.json#git-urls-as-dependencies (or similar, depending on how you deploy NPM packages).

@sys13
Copy link
Author

sys13 commented Nov 6, 2015

Having trouble installing it. I tried using this line in my packages.json file:

"formsy-material-ui": "https://github.com/mbrookes/formsy-material-ui/archive/0ee888be254a2ff8cd778eec51d2ea69e918b451.tar.gz",

but I got this error

error: couldn't install npm package
   formsy-material-ui@https://github.com/mbrookes/formsy-material-ui/archive/0ee888be254a2ff8cd778eec51d2ea69e918b451.tar.gz:
   Command failed: npm WARN package.json react-addons-create-fragment@0.14.2 No
   repository field.
   npm WARN package.json react-addons-pure-render-mixin@0.14.2 No repository
   field.
   npm WARN package.json react-addons-transition-group@0.14.2 No repository
   field.
   npm WARN package.json react-addons-update@0.14.2 No repository field.
   npm ERR! fetch failed
   https://github.com/mbrookes/formsy-material-ui/archive/0ee888be254a2ff8cd778eec51d2ea69e918b451.tar.gz
...
...
...

@mbrookes
Copy link
Collaborator

mbrookes commented Nov 7, 2015

npm ERR! fetch failed
https://github.com/mbrookes/formsy-material-ui/archive/0ee888be254a2ff8cd778eec51d2ea69e918b451.tar.gz

Not sure what that sha is, but it isn't from this repo!

Try:

"formsy-material-ui": "https://github.com/mbrookes/formsy-material-ui/archive/18a0e9be71fcec019f3add2a51535b8823d7e465.tar.gz",

@sys13
Copy link
Author

sys13 commented Nov 7, 2015

Thanks for the link. And it works great using the value prop. Also, I am no longer having an issue where it was requiring me to give focus to all required fields. Much appreciated.

@mbrookes
Copy link
Collaborator

mbrookes commented Nov 7, 2015

0.2.5 published.

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

3 participants