Closed jaimestuardo closed 9 years ago
solved by 1d45307e90f0a1c623176e3ee58f4a282241804c
You can see an example on the register page (we added an input type file)
It looks pretty, however, it does not show how to achieve that. I have checked and rechecked the tabs that appear below the form, but I don't see anything about Avatar control (I checked Models, Views and Controllers tabs)
I forgot to update the documentation.
Basically, you need to do this:
Model:
[BsControl(BsControlType.Upload)]
public HttpPostedFileBase Avatar { get; set; }
View:
<div class="input-group">
@Html.BsInputFor(m => m.Avatar)
@Html.BsValidationFor(m => m.Avatar)
</div>
JS (use the ajax wrapper and form parser):
var $form = $('.js-form');
var data = $form.parseForm();
$.bforms.ajax({
data: data,
url: 'controller/action'
});
I have done it, but this error occurs:
"The CheckList of type bs-file does not match an input element".... and in fact, I saw the source code and that error message appears when no case statement is matched, and in this case BsControlType.Upload is not matched.
This is how I am using CheckList control:
<div class="col-lg-12 form-group @Html.BsValidationCssFor(m => m.CheckList)">
@Html.BsLabelFor(s => s.CheckList)
<div class="input-group">
@Html.BsInputFor(s => s.CheckList)
@Html.BsValidationFor(s => s.CheckList)
</div>
</div>
Update your nugget package (or source files), we fixed it in today's commits.
hehehe.. thanks... I will do it right now
Hello,
I have a BsControlType.Upload property in my model:
And in my view, I have,
My attributes definition works, but adding the attributes, not replacing them, causing finally the control to be rendered as:
I have seen the source code and I think the problem is in the ApplyTextBoxAttributes method in TextBoxExtensions file.
I tried to recompile the solution, but it was not possible, so that i could not modify that code fragment.
Regards, Jaime