Xamarin.Forms.InputKit icon indicating copy to clipboard operation
Xamarin.Forms.InputKit copied to clipboard

Can submit button be used in a frame on a formview?

Open MarkLFT opened this issue 1 year ago • 5 comments

My Question Here ?

I am using a FormView, as the form is quite long, I want to display it in small cards. I am using Frames to group blocks of inputs, but if I try to put the Submit button into a frame for aesthetic purposes, it no longer triggers the command defined using the FormView submit command. Is this by design or am I just doing something wrong?

<input:FormView SubmitCommand="{Binding SubmitCommand}"
                    IsValidated="{Binding IsValidated}"
                    Spacing="10">
<Frame>
<Button Text="Save" input:FormView.IsSubmitButton="True"/>
</Frame>
</input:FormView>

MarkLFT avatar Mar 28 '23 03:03 MarkLFT

Yeah, it should be working since it looks or it recursively. If it doesn't work we can fix it if you share reproduction steps

enisn avatar Mar 28 '23 08:03 enisn

Thanks for the prompt response, I originally tried it in a frame, then in a plain VerticalStackLayout, and in both cases the command did not fire. But keep it as a direct child of the FormView and it fires.

Many thanks, this project is a great help for me. I am making my first app, and enjoying it.

MarkLFT avatar Mar 28 '23 08:03 MarkLFT

Ok, I'll investigate. It should be working, and currently it seems it's a bug. By the way, you can set your frame as submit button as a workaround until the bug is solved:

<Frame input:FormView.IsSubmitButton="True">
    <Button Text="Save" InputTransparent="True"/>
</Frame>

InputTransparent might be required for iOS & OSX

enisn avatar Mar 28 '23 09:03 enisn

Many thanks for the prompt action.

MarkLFT avatar Mar 28 '23 09:03 MarkLFT

Just to provide a little more feedback... The validations do not work also when in a frame.

'''

            <material:TextField Title="Manager Name" Icon="{FontImageSource FontFamily=MaterialRegular, Glyph={x:Static micons:MaterialRegular.Person}}" Text="{Binding License.Customer.CustomerName}" AllowClear="True">
                <validation:RequiredValidation/>
            </material:TextField>
            <material:TextField Title="Email Address" Icon="{FontImageSource FontFamily=MaterialRegular, Glyph={x:Static micons:MaterialRegular.Email}}" Text="{Binding License.Customer.EmailAddress}" AllowClear="True">
                <validation:RequiredValidation/>
                <validation:RegexValidation Pattern="{x:Static input:AdvancedEntry.REGEX_EMAIL}" Message="Please type a valid e-mail address." />
            </material:TextField>

        </VerticalStackLayout>
    </Frame>

'''

This code does not raise any warnings and goes directly to the Submit command, removing the frame and warnings are displayed as expected.

MarkLFT avatar Mar 29 '23 07:03 MarkLFT