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

bootsfaces script fails if id attribute contains - (hyphen) #441

Closed
susanne69 opened this issue Jun 28, 2016 · 10 comments
Closed

bootsfaces script fails if id attribute contains - (hyphen) #441

susanne69 opened this issue Jun 28, 2016 · 10 comments
Assignees
Milestone

Comments

@susanne69
Copy link

susanne69 commented Jun 28, 2016

Hi again,

I am not sure but shall bootsfaces be html5 conform?
the javascript is failing because I am using an id attribute like 'form-databable'. A widgetvar is created which then contains also a dash.That makes the script fail.
See https://www.w3.org/TR/html5/dom.html#the-id-attribute.

I have this problem with a b:dataTable in an h:form.

Kind regards,
Susanne

@stephanrauh
Copy link
Collaborator

BootsFaces is intended to be HTML5 conform within the limits of JSF. That means ids may consists of letters, digit, underscores and hyphens, but nothing else (see http://stackoverflow.com/questions/5972433/what-are-the-rules-for-a-jsf-id).

However, I believe your question aims at something different. I take it you're talking about the widget variable of b:dataTable? And you want us to convert the kebab-case id to a camelCase widget variable?

@susanne69
Copy link
Author

I am impressed by your prompt replies :)
OK, hyphen, I called it dash. Of course within the limits of JSF.
As you wish camelCase or snake_case, whatever makes it valid. If a simple concatenation of an id with a widget suffix name does not make a valid javascript variable you should take care of it. Why limit the id attribute for bootsfaces? It should add on and only limit if it saves our lives, right?

stephanrauh added a commit that referenced this issue Jun 28, 2016
@susanne69 susanne69 changed the title bootsfaces script fails if id attribute contains - (dash) bootsfaces script fails if id attribute contains - (hyphen) Jun 28, 2016
@zhedar
Copy link
Collaborator

zhedar commented Jun 28, 2016

Just by the way: congratulations Stephan, you've contributed the project's 1000th commit! ;)

@stephanrauh
Copy link
Collaborator

Whow!

@stephanrauh
Copy link
Collaborator

Done and documented.

Actually, this bug was pretty simple to fix. All I had to do is to call a method that's already there. I've uploaded a developer snapshot of BootsFaces 0.9.0 to Maven Central. See #369 on how to get it.

@stephanrauh stephanrauh added this to the v0.9.0 milestone Jun 28, 2016
@stephanrauh stephanrauh self-assigned this Jun 28, 2016
@susanne69
Copy link
Author

Closing it was to early I think.
Have you tested it?
I used to be a developer, actually I still am, so I know 'wie wir ticken'.

I do not get any script errors but the whole search thing does not appear.
I have tried the following:
id="formkunde": works fine
id="form_kunde": works fine
id="form-kunde": no search, paging of filter input fields appear

the function is called snakeCaseToCamelCase so my assumption is now that it's only a cosmetic thing rather than taking care of the validity of a variable name.

How about including my kepab? or adding a wiki that only underscores are allowed in bootsfaces but that would be poor wouldn't it?

@stephanrauh stephanrauh reopened this Jun 28, 2016
stephanrauh added a commit that referenced this issue Jun 28, 2016
stephanrauh added a commit that referenced this issue Jun 28, 2016
@stephanrauh
Copy link
Collaborator

Well, I did test it, but I tested the wrong thing... :)

It should be better now. I've uploaded another snapshot to Maven Central.

@susanne69
Copy link
Author

It works!
Thank you.
I have not tested it in other components than though.

@stephanrauh
Copy link
Collaborator

Currently, the data table is the only component that has a publicly exposed widgetVar. But of course, it's possible that we've used the clientId to define a variable in one of our 66 components.

BTW, I didn't know the "hooray" emoji yet :).

@susanne69
Copy link
Author

I will have an eye on the "others" :)

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

No branches or pull requests

3 participants