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

b:inputText labelColMd #735

Closed
chongma opened this issue Apr 26, 2017 · 16 comments
Closed

b:inputText labelColMd #735

chongma opened this issue Apr 26, 2017 · 16 comments

Comments

@chongma
Copy link
Collaborator

chongma commented Apr 26, 2017

i have been using <b:inputText label="something" value="#{myBean.myValue}" /> for a while because it looks nice and cuts down a lot on coding. i noticed that there were the labelColXx attributes and thought these were intended to allow the label to layout next to the control. i tried labelColMd="one-third" but it doesn't seem to have any effect other than add a couple of spaces in front of the label. does it need to be used in conjunction with colMd="two-thirds"? if so fit does not seem to work on my setup

@ggam
Copy link
Collaborator

ggam commented Apr 26, 2017

labelColMd is intented to be used with a numeric (1 to 12) value. If you want to use the special string, you'll need to use the labelMediumScreen attribute.

@chongma
Copy link
Collaborator Author

chongma commented Apr 26, 2017

on my setup it does not work with numbers it is exactly the same. i tried labelColMd="3". also if it is only numeric then should the documentation be changed to reflect this?

@stephanrauh
Copy link
Collaborator

labelColMd is intented to be used with a numeric (1 to 12) value.

My intention was to leave the programmer as much freedom as possible. If labelColMd requires numeric values, I'd consider this a (minor) bug. I'll check this later.

@stephanrauh
Copy link
Collaborator

Which HTML code should <b:inputText label="something" labelColMd="one-third" /> render?

Currently it renders this HMTL code:

<div id="j_idt174" class="form-group">
  <label for="input_j_idt174" class=" col-md-4 control-label">something</label>
  <input id="input_j_idt174" name="input_j_idt174" type="text" class="form-control">
</div>

It works as designed, but this particular cornercase isn't really supported because we never defined the semantics of labelColXX="4" colXX="(nothing)".

@chongma
Copy link
Collaborator Author

chongma commented Apr 26, 2017

I tried adding both labelColMd and colMd earlier and it didn't help

@stephanrauh
Copy link
Collaborator

Let's track the bug down step by step. What's the behavior you expected? Or putting it the other way round, what did not happen after adding both labelColMd and colMd?

More technically speaking: which HTML code is rendered, and which HTML code do you want BootsFaces to rendered?

@stephanrauh
Copy link
Collaborator

@chongma May I "ping" you? :)

@chongma
Copy link
Collaborator Author

chongma commented Apr 30, 2017

Sorry I never replied your to your previous comment

@chongma chongma closed this as completed Apr 30, 2017
@chongma chongma reopened this Apr 30, 2017
@chongma
Copy link
Collaborator Author

chongma commented Apr 30, 2017

Sorry I closed the issue accidentally. I am on a phone. My understanding of the documentation was that defining those two attributes like

<b:inputText value="#{myBean.value}" labelColMd="3" colMd="9"/>

would lay out text input like

<b:row>
  <b:column colMd="3">
    <h:outputLabel value="something"/>
  </b:column>
  <b:column colMd="9">
    <b:inputText value=”#{myBean.value}”/>
  </b:column>
</b:row>

It doesn't seem to do that so maybe I don't understand it correctly

@stephanrauh
Copy link
Collaborator

If you're using horizontal forms, the HTML code looks almost like you're expecting:

<b:form horizontal="true">
  <b:inputText value="#{myBean.value}" labelColMd="3" colMd="9" label="My label"/>
</b:form>

generates

<div id="j_idt20:j_idt21" class="form-group ">
  <label for="input_j_idt20:j_idt21" class=" col-md-3 control-label">My label</label>
  <div class="col-md-9">
    <input id="input_j_idt20:j_idt21" name="input_j_idt20:j_idt21" type="text" class="form-control">
  </div>
</div>

@stephanrauh
Copy link
Collaborator

You're right that the generated code for stacked forms is a bit odd. I think that's exactly the breaking change introduced by correcting the HTML code (#682, #685, #614, and #493).

@chongma
Copy link
Collaborator Author

chongma commented May 1, 2017

is the problem that i am using h:form instead of b:form? i tend to stick to h:form as i don't fully understand the difference

@ggam
Copy link
Collaborator

ggam commented May 1, 2017 via email

@stephanrauh
Copy link
Collaborator

stephanrauh commented May 1, 2017

@chongma @ggam I've just seen that there is a difference between h:form and b:form, indeed. Both horizontal and inline forms require b:form. As far as I remember, the original design was a bit more lenient. You could use both tags. I've invented the BootsFaces version because it's the only way to get rid of the error messages of Netbeans, which doesn't accept non-standard attributes on JSF components.

So we might need to update the documentation.

@chongma
Copy link
Collaborator Author

chongma commented May 3, 2017

you can probably close this bug? i haven't tried horizontal b form or form-group as i don't have much time at the moment but i imagine it will work. i read the documentation for labelColMd and colMd on inputText so i didn't see it related to the main horizontal forms documentation.

@stephanrauh
Copy link
Collaborator

I guess we've changed the meaning of horizontal, stacked and inline forms recently, confusing you and (probably) many other programmers. I hope this doesn't cause too many problems.

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