Code Monkey home page Code Monkey logo

Comments (14)

josevalim avatar josevalim commented on May 14, 2024 3

@kakubei you simply need to pass the new type:

= country_form.input :country :as => :select

It is documented and there is a huge table in the README.

from simple_form.

taimoor018 avatar taimoor018 commented on May 14, 2024 2

As per my understanding after reading your question, you should get countries list from table in a variable then use that variable in select_tag instead of using simple_form

from simple_form.

nashby avatar nashby commented on May 14, 2024 2

@kakubei you can specify string input with :as => :string

from simple_form.

josevalim avatar josevalim commented on May 14, 2024 1

You need to install country_select as plugin in order for it to work. I believe an error should have been raised.

from simple_form.

wilkerlucio avatar wilkerlucio commented on May 14, 2024 1

will be nice to have this on documentation at installation section, will help others to don't fall in this problem :)

from simple_form.

josevalim avatar josevalim commented on May 14, 2024

Please update the docs and send me a pull request then!

from simple_form.

taimoor018 avatar taimoor018 commented on May 14, 2024

Hi I tried both plugin and gem f country select but all in vain. Getting error when installed

ActionView::Template::Error (undefined method `country_select' for #ActionView::Helpers::FormBuilder:0x7fd7eaa1ad78):

can any one help and provide its Doc in help file about its useage :) thanks in advance

from simple_form.

taimoor018 avatar taimoor018 commented on May 14, 2024

Friends I've found the answer of the question. I posted above. I did not restart the server after installing plugin. :) hurrra

from simple_form.

kakubei avatar kakubei commented on May 14, 2024

I get the same error, but I'm not using the plugin, nor do I wan to use it, I simply want to grab all the countries from within a table I already have. This error is coming up because presumably simple_form is getting confused by the :country symbol and wants to call the plugin. I simply want to list what I've retrieved from my own countries table with a column called 'country'.

Surely there is a workaround for this?

from simple_form.

kakubei avatar kakubei commented on May 14, 2024

@taimoor018 Why would I need to do that, when all my other forms work? Is there no other workaround? Also, I get the same error using neste fields:

= simple_form_for @DVD do |f|
= f.simple_fields_for :dvd_country do |country_form|
= country_form.input :country

from simple_form.

kakubei avatar kakubei commented on May 14, 2024

@josevalim Thanks Jose, I didn't actually see that in the readme. What I want is a text field, so I'll use :as => text. Let me ask you, speaking of text, is there a way to specify a text input as opposed to textarea?

Again, I didn't see any option for that in the readme (just text which creates a textarea).

By the way, thanks for this wonderful gem it is truly fantastic. Muito obrigado.

from simple_form.

kakubei avatar kakubei commented on May 14, 2024

@nashby thanks so much, how dumb of me! :P

from simple_form.

benbonnet avatar benbonnet commented on May 14, 2024

Am I right to think that,

with the following :

= f.input :shipping_country, label: "blah blah", :wrapper_html => {:class => "field half right"}

and getting the following error :

undefined method `country_select' for #<SimpleForm::FormBuilder:0x007f87f3779f98>

your plugin is a little bit too strict on the transformation of the word "country" ?

from simple_form.

carlosantoniodasilva avatar carlosantoniodasilva commented on May 14, 2024

@bbnnt it assumes a default which most people would use, which is the country select plugin, but it is flexible enough by allowing you to easily configure it to be different, completely ignoring country select. Check #757 for more info.

from simple_form.

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.