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

ExtraSignupField Checkbox support #336

Open
BillyParadise opened this issue Dec 24, 2014 · 1 comment
Open

ExtraSignupField Checkbox support #336

BillyParadise opened this issue Dec 24, 2014 · 1 comment

Comments

@BillyParadise
Copy link

Hi, I'm trying to add a checkbox field to the signup form, without much success.

Code:

AccountsEntry.config:

extraSignUpFields: [{
        ...
       },{
        field: "supplierReg",                      
        label: "Register as a Supplier",      
        type: "check_box"                          // also tried checkbox
       }]
Accounts.onCreateUser(function(options, user) {

  user.profile = {
    username: user.username,
    supplier: user.supplierReg
  };

Username is getting serialized to the database properly - what am I doing wrong for the supplier checkbox?

If a dropdown works, I'm OK with switching to that as well, though I didn't find any examples of people using dropdowns, either.

Thanks

@ghost
Copy link

ghost commented Apr 6, 2015

In my case, I need to go to simple-form/helpers.js and change the 1 line of code of UI.registerHelper('check_box', function(field, options) , changing "label for=field" to "label class="checkbox":
from


 html = "[label for='"+ field +"'][input id='"+ field +"' name='" + field + "' type='hidden' value='false']
[input name='" + field + "' class='"+ html_class +"' type='checkbox' value='true' " + checked + required + "]" + label + "[/label]";  

to


 html =" [label class=checkbox]
[input id=+ field + name= + field +  type=hidden value=false]
[input name= + field +  class=+ html_class + type=checkbox value=true  + checked + required + ] + [/label]+label"

I'm using ionic css, so the previous code does not render it correctly.
My suggestion is to compare the string that UI helper builds with the accurate html code for that item.

P/S: I have to convert the < > tags in my code to [ ] , otherwise github truncates my code, dont know why?

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

1 participant