The following patch is a quick fix that I needed for responsive inputs on a project I'm working on. I'm sure this isn't the cleanest way to add the required classes to make form inputs bootstrap-responsive, but perhaps someone else could take a look to see if this could be improved?
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 2012-11-29_06h25_50.png | 47.05 KB | andregriffin |
| #5 | 2012-11-29_06h27_13.png | 53.68 KB | andregriffin |
| #2 | responsive_inputs.patch | 2.25 KB | andregriffin |
| #1 | responsive-inputs.patch | 2.27 KB | andregriffin |
| responsive-inputs.patch | 2.51 KB | andregriffin |
Comments
Comment #1
andregriffin commentedWhoops, I narfed that last patch.
Comment #2
andregriffin commentedNew patch for testing.
Comment #3
frankbaele commentedseems to break the styling of my input fields and also overwrites search input, everything works fine out of the box with boostrap 2.2.1
Comment #4
frankbaele commentedComment #5
andregriffin commentedI suppose I should have clarified what this aims to do. When the window is sized down to mobile size, inputs retain their maxlength value and run off the page. A bootstrap input-size class needs to be added to all inputs to allow them to resize properly for mobile layouts. See attached images.
Also, can you clarify what it breaks so that I can take a look?
Comment #6
jaguero commented@andregriffin
Can you add a check code below and maybe add it to patch for prefix/suffix check to add input size accordingly. Below is what I added to my input field to work for the time being, not sure if it is the best method.
Comment #7
andregriffin commentedHm, I'm having a little difficulty finding the most appropriate way to get these classes added, and I'd still like to know what problems were caused earlier. Care to shed any light on this frank, or anyone?
Comment #8
bfodeke commentedI was able to solve this issue with a few lines of css
Instead of width: 100%, you can do max-width:100%. The magic here is 'box-sizing:border-box'.
Comment #9
markhalliwellForm inputs often have various width needs depending on the input/site. These should also be handled by the input's
sizeattribute (which can be controlled in FAPI). All that's really needed here, is to ensure they don't even overflow the parent container. The technique @bfodeke uses in #8 is correct. I've used this technique for a while and just patched all the styling fixes in #1984354: Improve LESS/CSS consistency..Comment #10
markhalliwellSorry, should have marked this as a dup of #1984354: Improve LESS/CSS consistency. instead of fixed (since no code from this issue was actually committed).