2

Ok i have :

<div class="form-group">
<label for="address" class="control-label col-lg-5 col-md-6">                                @Html.Label(@Translator.Translate("STREET_ADDRESS")):
<span ng-show="editUserForm.Address.$error.required" class="required">*</span>
</label>
<div class="col-lg-7 col-md-6">
@Html.TextBoxFor(m => m.Address, new {name="Address", @class = "form-control", id = "address", @maxlength = "30", ng_model = "address", @required = "required", ng_pattern = @"/[A-Za-z]+ ?[0-9]+$/" })
</div>
</div>

So my idea is when this textbox is empty that show * but for me it not working...Any help?

6
  • What happens if you click in the text box (give it focus) and then click away (blur)? Commented Jun 29, 2015 at 13:31
  • for now i able to made iwhen user enter address textbox gets green when is empty textbox is red...but im not able also to show * when its empty Commented Jun 29, 2015 at 13:33
  • if it click in textbox and then click away depends of what user enter Commented Jun 29, 2015 at 13:35
  • 1
    what about <span ng-show="!!address">*</span> ? Commented Jun 29, 2015 at 13:42
  • yes...with one ! not double :) tnx Commented Jun 29, 2015 at 13:45

2 Answers 2

2

(Moved from comments) Change the span to this:

<span ng-show="!address">*</span>
Sign up to request clarification or add additional context in comments.

Comments

0

try this

   <span ng-show="editUserForm.Address.$dirty && editUserForm.Address.$error.required" class="required">*</span>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.