bem / bem-components

Set of components for sites development
https://bem.info/libraries/classic/bem-components/6.0.0/
Other
333 stars 87 forks source link

input_type_hidden #1379

Closed awinogradov closed 9 years ago

awinogradov commented 9 years ago

Hi, guys!:) What about this #554 issue? We work on bem-forms library and base form fields on bem-components inputs. Now we think about hidden form fields and we need to input_type_hidden:) I know you close issue about this. Why? This mod would be realized in v2, but it is not.

tadatuta commented 9 years ago

@verybigman 'coz you may use

{ tag: 'input', attrs: { type: 'hidden' } }

instead ;)

awinogradov commented 9 years ago

Yes, I can:) but also I can { tag: 'input', attrs: { type: 'password' } } :) I want use hidden input with api, like other inputs. And add attributes like for other inputs. Why not?

Чт, 26 февр. 2015 г. в 15:47, Vladimir Grinenko notifications@github.com:

@verybigman https://github.com/verybigman 'coz you may use

{ tag: 'input', attrs: { type: 'hidden' } }

instead ;)

— Reply to this email directly or view it on GitHub https://github.com/bem/bem-components/issues/1379#issuecomment-76172265.

tadatuta commented 9 years ago

i think you need block control with { tag: 'input', attrs: { type: 'hidden' } }, don't you? block input has some things which are useless for <input type="hidden">, e.g. https://github.com/bem/bem-components/blob/v2/common.blocks/input/input.bemhtml#L7 so in case of adding such modifier, biggest part of code would be to cancel previous declarations.

awinogradov commented 9 years ago

Ok, we don't need wrappers for control like other input blocks. But what is bad is to write a template modifier without wrappers? We want a consistent interaction with entities of the same type.

qfox commented 9 years ago

@verybigman You just stick to HTML inputs. Free your mind of it!

awinogradov commented 9 years ago

@zxqfox hast thou not been for the degradation to normal form post ;)

awinogradov commented 9 years ago

There is some argument for not doing this modifier? We can add it in bem-forms if here it is superfluous.

tadatuta commented 9 years ago

@verybigman can you provide examples of usage?

awinogradov commented 9 years ago

Yes! For example i use hidden input for type of value in another input. When value in another input is changes i change type in hidden input:)

tadatuta commented 9 years ago

are you sure that's the best way? ;) please describe the whole task.

awinogradov commented 9 years ago

Yes. Server wait two fields. First is value, where can be number or string. Second is value type field (hidden). Users can't edit type, they edit value with mask.

tadatuta commented 9 years ago

First of all you can never trust anything from client side so you have to check all user input on server side anyway. And as so why not just get type on server and get rid of that second field at all?

awinogradov commented 9 years ago

I think the conversation did not go there:) We have of course server validation. But we think here about front-end. In addition to the expectations of the server with hidden fields containing types or something else related interface blocks. The fields in the form can be dynamic, that is to appear and disappear. A intermediate data must also be stored somewhere. And with all this, you should be able to do a normal post request:)

tadatuta commented 9 years ago

In case in just need to hide some parts of form and still post it's values to server (which is far from previous examples ;)) you can just use display: hidden in CSS, can't you?

I want detailed real-life example of the situation when you really need input type="hidden" as an instance of input BEM block. Now I believe it's unnecessary because in my practice there's no such cases.

awinogradov commented 9 years ago

Problem will be solved in bem-forms