How to create a hint "Optional for the Company name field on registration page?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 years ago
Hi:
I would like to insert a hint with a value = Optional in:
 
@if (Model.CompanyEnabled)
{
   <div class="inputs">
  @Html.LabelFor(model => model.Company, new { }, ":")
  @Html.EditorFor(model => model.Company)
  @if (Model.CompanyRequired)
    {
      @Html.RequiredHint()
    }
  @Html.ValidationMessageFor(model => model.Company)
   </div>
}


i created an string like "Account.CompanyDetails.Hint" included it as a function arg, and added a new record to admin/lang/resources, but it doesn't seem to be formatted correctly
Thank you
10 years ago
did u add "Account.CompanyDetails" to company in the model?
10 years ago
Hi Hezy, thank you for you sharp insight on the issue and for taking your time to respond.
It was the missing resourcename attribute at the Model interface as you cleverly pointed out, that was preventing the code to run, however what I really was looking for wasn't a hint for the required Company field, rather than to have, a value of optional as placeholder for the "enabled" Company field.  
Certain customers tend to struggle filling forms that aren't clear enough in their view, so a hint is a welcome help for them in most cases.

So that what I did:
1)--changed the
@Html.EditorFor(model => model.Company)
for
@Html.TextBoxFor(model => model.Company, new { @class = "company", placeholder=T("Account.Fields.CompanyName.Hint") })


2)--created the model resource attribute
[NopResourceDisplayName("Account.Fields.CompanyName")]


3)--added a new record to the admin resources as
account.fields.companyname.hint
with a value = Optional

4)-- recompiled

Everything look and work as I fine now

Thank you again!!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.