Skip to content
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

Documentation for Addon to contain Validation info #4740

Closed
oaldrian opened this issue Apr 17, 2023 · 3 comments
Closed

Documentation for Addon to contain Validation info #4740

oaldrian opened this issue Apr 17, 2023 · 3 comments
Assignees
Labels
Type: Feature ⚙ Request or idea for a new feature.
Projects
Milestone

Comments

@oaldrian
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When working with Addon and Validation, there are a few extra steps to take to make it visually "correct".
These are described in #4106

Describe the solution you'd like
The solution (or a different one, that has a similar result) of #4106 should be added to the Addon docs, as apart from this issue the info is not easily available.

@oaldrian oaldrian added the Type: Feature ⚙ Request or idea for a new feature. label Apr 17, 2023
@stsrki stsrki self-assigned this Apr 17, 2023
@stsrki stsrki added this to 🔙 Backlog in Support via automation Apr 17, 2023
@stsrki stsrki added this to the 1.2 support milestone Apr 17, 2023
This was referenced Apr 19, 2023
@stsrki stsrki closed this as completed Apr 19, 2023
Support automation moved this from 🔙 Backlog to ✔ Done Apr 19, 2023
@sturlath
Copy link
Contributor

sturlath commented May 4, 2023

I guess this “solves” this one #3802 right?

@stsrki
Copy link
Collaborator

stsrki commented May 4, 2023

@sturlath Yes, it should work with #3802. But you will have to adjust the Addons structure according to the documentation example.

@sturlath
Copy link
Contributor

@stsrki Just tried this with 1.3.1 and this code here does not work. And I can´t see better than your validation example doesn´t either..

<Column>
    <Field>
        <FieldLabel>@L["StartingDate"]</FieldLabel>
        <Validation Validator="@ValidateEventStartingDate">
            <Addons>
                <Addon AddonType="AddonType.Body">
                    <DatePicker @ref="@startingDatePicker" TValue="DateTime?" InputMode="DateInputMode.Date" Date="@NewStreamEvent.StartingDate" DateChanged="@OnStartingDateChanged" DisplayFormat="dd-MM-Y" Disabled="@DisabledMode">
                    </DatePicker>
                </Addon>
                <Addon AddonType="AddonType.End">
                    <Button Color="Color.Light" Clicked="@(()=>startingDatePicker.ToggleAsync())">
                        <Icon Name="IconName.CalendarDay" />
                    </Button>
                </Addon>
            </Addons>
            <ValidationNone></ValidationNone>
            <ValidationSuccess></ValidationSuccess>
            <ValidationError>@L["PleaseSelectValidFutureStartingDateForEventDate"]</ValidationError>
        </Validation>
    </Field>
</Column>
  private void ValidateEventStartingDate(ValidatorEventArgs e)
  {
      if (StartingDateInPastNotAllowed)
      {
          if (!NewStreamEvent.StartingDate.HasValue || NewStreamEvent.StartingDate.Value.DayOfYear < Clock.Now.DayOfYear)
          {
              e.Status = ValidationStatus.Error;
          }
          else
          {
              e.Status = ValidationStatus.Success;
          }
      }
  }
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature ⚙ Request or idea for a new feature.
Projects
Support
  
✔ Done
Development

No branches or pull requests

3 participants