-
Notifications
You must be signed in to change notification settings - Fork 205
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
Add form elements dynamically with ajax #57
Comments
Well that's actually more of a Bootstrap problem than a Former one : Former automatically creates the correct Bootstrap syntax to have fields all in the right places but in Javascript I don't really know how you could make them render properly without using all the control group syntax : http://twitter.github.com/bootstrap/base-css.html#forms |
I see, but what happens is that without creating the Former::open() the group syntax is not created for the field. The output for the following code is: {{Former::mini_text('visa_value[]','visa_value')->prepend('$')->required()->class('span9')->value($visa_option->value)}} <label for="visa_value[]">Valor<sup>*</sup></label>
<input class="span9" required="true" type="text" name="visa_value[]" id="visa_value[]"> when was supposed to be: <div class="control-group required">
<label for="visa_value[]" class="control-label">Valor<sup>*</sup></label>
<div class="controls">
<div class="input-prepend">
<span class="add-on">$</span>
<input class="span9" required="true" type="text" name="visa_value[]" id="visa_value[]">
</div>
</div>
</div> That's why I thought could be a Former issue for not generating the control group syntax. |
Now that's normal, by default fields outside of a form are considered inline because most of the time when you put fields outside of forms it's in random places, tables and stuff. This is kind of one of the tricky parts of Former. I don't think there's a way to add the control group for a specific field outside of a form. You can do the opposite (remove the group with |
That's right, make sense. I can try to think in a best way, but the way that just poped in my mind, Former::mini_text(...); You can set also if you want in a group control, something like: Former::grouped_mini_text(...); Former::group_mini_text(...); Or any other word that make more sense. |
Hm this is not bad, I'll think about it see what I come up with. |
OK, thanks |
Hi there, this is more a questions than an issue.
I'm trying to append form elements to my form dynamically through ajax, the idea is that the user can add many options of this field as he/she wants.
So I don't need to open another form tag for these elements because I'll append to inside an existing form. But the problem is when I create my form elements in another page, that I'll load through ajax, the form elements doesn't render properly if I don't user the Former::open() function.
There is/are any thing I can do to the form elements render properly without need to call the function Former::open();
Hope my question make sense, sorry for my english
The text was updated successfully, but these errors were encountered: