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

Inline forms don't work #27

Open
vincentsch opened this issue Jan 23, 2013 · 5 comments
Open

Inline forms don't work #27

vincentsch opened this issue Jan 23, 2013 · 5 comments

Comments

@vincentsch
Copy link

After spending the last 4 hours with your library and still having this problem I decided to open up a new issue.

Problem is: Inline forms don't work. If I do setAttrib("inline", true); it does add the class="form-inline" to the form element.

But it looks like there are a lot of decorator divs ('controls' and 'control-group') hard-coded that mess up everything so inline forms are not displayed as inline ..

@ravidhu
Copy link
Contributor

ravidhu commented Jan 23, 2013

I just tested and it works with setAttrib("inline", true), have you checked your css ?

@vincentsch
Copy link
Author

@ravid87: Thanks for your fast reply! I appreciate that :)

Here's my code:

$form = new Twitter_Form();
$form->setAttrib("inline", true);
$form->addElement('text', 'mytext', array('attribs' => array('placeholder' => 'Write something ...')));
$form->addElement('select', 'myselect', array('multioptions' => array(0 => 'Zero', 1 => 'One')));
$form->addElement('submit', 'Submit');
echo $form;

That's what I get:
Screenshot_1

<form class="form-inline" enctype="application/x-www-form-urlencoded"
    inline="1" action="" method="post">
    <fieldset inline="1">
        <div class="control-group">
            <div class="controls">
                <input type="text" name="mytext" id="mytext" value=""
                    placeholder="Write something ...">
            </div>
        </div>
        <div class="control-group">
            <div class="controls">
                <select name="myselect" id="myselect">
                    <option value="0">Zero</option>
                    <option value="1">One</option>
                </select>
            </div>
        </div>
        <div class="form-actions">
            <input type="submit" name="Submit" id="Submit" value="Submit"
                class="btn btn-primary">
        </div>
    </fieldset>
</form>

Looks like the problem are all those divs .. The html should be something like this (but it isn't, I coded this example manually):
Screenshot_2

<form class="form-inline" enctype="application/x-www-form-urlencoded"
    inline="1" action="" method="post">
    <fieldset inline="1">
        <input type="text" name="mytext" id="mytext" value=""
                    placeholder="Write something ...">
        <select name="myselect" id="myselect">
            <option value="0">Zero</option>
            <option value="1">One</option>
        </select>
        <input type="submit" name="Submit" id="Submit" value="Submit"
                class="btn btn-primary">
    </fieldset>
</form>

@ravidhu
Copy link
Contributor

ravidhu commented Jan 25, 2013

you need to remove the decorators of the text elements, i'll try do some workaround when i'll have some free time, i'll keep in touch ;)

@ravidhu
Copy link
Contributor

ravidhu commented Jan 25, 2013

problem resolved ^^

@vincentsch
Copy link
Author

Thank you very much! :+1 :-)

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

No branches or pull requests

2 participants