Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why error message is not shown
Message
From
12/09/2016 06:50:50
Thomas Ganss (Online)
Main Trend
Frankfurt, Germany
 
General information
Forum:
Javascript
Category:
Other
Miscellaneous
Thread ID:
01640697
Message ID:
01640712
Views:
40
The thing registring on first glance is different method signature found between:
>                            @String.Format(Messages.mustBeBetweenXandY, Messages.maxAgeLocalSalespoint, "1", "45")
and
>                                        @String.Format(Messages.dataRange, "-100", "100")
Nothing preventing something like that in JS, but might be a copy/paste error - dunno what parameters are acceptable for that function.
Might be just an eval-similar construct to allow calling methods tagged by first parameter with totally different signatures
- but even then it should be more under ".Validate" than .Format ;-)

Pet rant (NOT to be taken personally!):
That small part of the code already shows the non-DRY cruft creeping into HTML due to not being a programming language.
Strings like
>                           ng-hide="(form.editPaDSSForm.maxDaysLocal.$error.max || form.editPaDSSForm.maxDaysLocal.$error.min) && form.editPaDSSForm.maxDaysLocal.$dirty"
>                               ng-show="(form.editPaDSSForm.maxDaysLocal.$error.max || form.editPaDSSForm.maxDaysLocal.$error.min) && form.editPaDSSForm.maxDaysLocal.$dirty">
should never be duplicated in "source". In any programming language you would dedupe into:
a constant, a local variable, a property of enclosing DIV, a global data store/key-value collection or risk flogging on the spot,
but creating a "constant store" via script in HTML adds indirection to mental and actual code flow in exchange for DRYing up.
One argument for Mithril/React style of fwks, especially if you consider how many people read the duplicated stuff you posted slowly to notice small changes....
/rant

>I made some changes:
>
>
><ng-form name="editPaDSSForm">
>    <div class="form-horizontal">
>        <div class="row">
>            <div class="form-group">
>
>                <div class="col-xs-6">
>                    <label class="control-label"
>                           ng-hide="(form.editPaDSSForm.maxDaysLocal.$error.max || form.editPaDSSForm.maxDaysLocal.$error.min) && form.editPaDSSForm.maxDaysLocal.$dirty"
>                           title="@Messages.maxAgeLocalSalespoint">@Messages.maxAgeLocalSalespoint</label>
>                        <label class="field-validation-error control-label-error animate-show"
>                               ng-show="(form.editPaDSSForm.maxDaysLocal.$error.max || form.editPaDSSForm.maxDaysLocal.$error.min) && form.editPaDSSForm.maxDaysLocal.$dirty">
>                            @String.Format(Messages.mustBeBetweenXandY, Messages.maxAgeLocalSalespoint, "1", "45")
>                        </label>
>
>                        <input type="number" name="maxDaysLocal"
>                               id="maxDaysLocal"
>                               min="1" max="45"
>                               ng-model="currentPrefs.loclccdays"
>                               class="form-control"
>                               placeholder="0"
>                               data-sm:number data-accuracy="0">
>
>
>                    </div>
>                </div>
>            </div>
>        </div>
> </ng-form>
>
>The above is not working :(
>
>And this works fine - do you see any difference?
>
>
><div class="col-lg-3 col-md-6">
>                                <div class="format-label">
>                                    <label class="control-label" 
>                                           ng-hide="(form.editSpecialGeneralForm.discPct.$error.max || form.editSpecialGeneralForm.discPct.$error.min) && form.editSpecialGeneralForm.discPct.$dirty">@Labels.percentage:</label>
>                                    <label class="field-validation-error control-label-error animate-show" 
>                                           ng-show="(form.editSpecialGeneralForm.discPct.$error.max || form.editSpecialGeneralForm.discPct.$error.min) && form.editSpecialGeneralForm.discPct.$dirty">
>                                        @String.Format(Messages.dataRange, "-100", "100")
>                                    </label>
>                                </div>
>                                <div class="input-group">
>                                    <input class="form-control percent-icon" id="discPct" max="100" min="-100"
>                                           name="discPct"
>                                           placeholder="0"
>                                           ng-model="currentSpecial.discPct" type="number"
>                                           data-sm:number data-accuracy="0">
>                                    @*<span class="input-group-addon">%</span>*@
>                                </div>
>                            </div>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform