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

SelectBoxIt applies itself to hidden form fields #94

Closed
peterfarrell opened this issue Jan 13, 2013 · 6 comments
Closed

SelectBoxIt applies itself to hidden form fields #94

peterfarrell opened this issue Jan 13, 2013 · 6 comments
Assignees
Labels

Comments

@peterfarrell
Copy link

We have some conditional fields -- something they are hidden because the user isn't allowed to select something and a hidden field + text is used instead:

<cfif usrType != 'Trainer'>
    <form:select name="primary_trainer" id="primary_trainer" path="primary_trainer.admin_id" class="span4">
        <form:option value="" label="Please select a trainer"/>
        <form:options items="#variables.admins#" labelCol="displayName" valueCol="admin_id" />
    </form:select>
<cfelse>
    <p><span class="uneditable-input">#variables.adminBean.getFormattedName()#</span></p>
    <form:hidden name="primary_trainer" value="#variables.adminBean.getAdmin_id()#" />
</cfif>

SelectBoxIt tries to apply itself to the hidden form field.

@ghost ghost assigned gfranko Jan 13, 2013
@gfranko
Copy link
Owner

gfranko commented Jan 13, 2013

I just released SelectBoxIt v2.8.0, which no longer calls SelectBoxIt on hidden select boxes. Let me know if you need anything else!

@gfranko gfranko closed this as completed Jan 13, 2013
@peterfarrell
Copy link
Author

Thanks. I'll grab the new release.

gfranko added a commit that referenced this issue Jan 14, 2013
@gfranko
Copy link
Owner

gfranko commented Jan 14, 2013

@peterfarrell I have found certain use cases where calling SelectBoxIt on hidden select box elements is a valid use case. Because of this, I have reverted the SelectBoxIt logic to allow SelectBoxIt to be called on hidden select box elements. If you do not want to call SelectBoxIt on hidden select boxes, consider altering your jQuery DOM selection statement, like this:

    $("select:visible").selectBoxIt();

@peterfarrell
Copy link
Author

I should have been more clear. I mean applying a selectboxit on a:

<input name="foo" type="hidden" />

gfranko added a commit that referenced this issue Jan 14, 2013
@gfranko
Copy link
Owner

gfranko commented Jan 14, 2013

Ahh got it. I just updated the code to not run SelectBoxIt on elements other than select boxes. Thank you for clarifying!

@peterfarrell
Copy link
Author

Awesome thanks! The reason why I reported it is that in our -- an if condition either shows a select box or text with form hidden input (if you don't have the right to select anybody else but yourself). Both have the same ID.

The funny thing that selectboxit made the hidden field visible and hence the bug report.

Thanks for fixing so fast!

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

No branches or pull requests

2 participants