Completed
Last Updated: 09 Oct 2024 11:21 by ADMIN
Stewart
Created on: 24 Aug 2022 13:43
Category: Form
Type: Bug Report
1
Empty FormButtons Print issue

Hi, 

I came across some unusual behaviour

I wanted to hide the default form submit button so I could put it elsewhere on the page but once I had an empty FormButton element on the page I was unable to print any more

<FormButtons></FormButtons>

a solution to my problem was to put an empty span in the element

<FormButtons><span></span></FormButtons>

4 comments
ADMIN
Dimo
Posted on: 09 Oct 2024 11:21

Hello everyone,

I can't seem to reproduce the problem anymore, but just in case, here is how to hide the empty <FormButtons> container completely, so that it doesn't interfere with printing:

<style>
    .no-form-buttons .k-form-buttons {
        display: none;
    }
</style>

<TelerikForm Model="@Employee"
             Width="300px"
             Class="no-form-buttons">
    <FormItems>
        <FormItem Field="@nameof(Person.FirstName)" LabelText="First Name"></FormItem>
        <FormItem Field="@nameof(Person.LastName)" LabelText="Last Name"></FormItem>
        <FormItem Field="@nameof(Person.BirthDate)" LabelText="Birth Date"></FormItem>
    </FormItems>
    <FormButtons></FormButtons>
</TelerikForm>

@code {
    private Person? Employee { get; set; } = new();

    public class Person
    {
        public string FirstName { get; set; } = string.Empty;

        public string LastName { get; set; } = string.Empty;

        public DateTime? BirthDate { get; set; }
    }
}

 

Regards,
Dimo
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

ADMIN
Tsvetomir
Posted on: 31 Aug 2022 12:10

Hi Stewart,

Thank you for sharing the sample REPL. Indeed, I have closely examined it and I can conclude that this should rather be considered a browser bug. I have modified the example to use a plain div with display: flex CSS rule and the print does not execute correctly. 

A similar topic has been discussed in this SO thread. What I can recommend is that you stick with the non-empty div element.

Kind regards,
Tsvetomir
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Stewart
Posted on: 31 Aug 2022 10:15

Hi Tsvetomir,

 

I have created as simple of an example as possible.

 

https://blazorrepl.telerik.com/mGEinvFE12pftWC840

 

just click print

 

Regards

Stewart

ADMIN
Tsvetomir
Posted on: 30 Aug 2022 15:34

Hi Stewart,

Thank you for sharing the approach that you have undertaken to hide the buttons. Indeed, supplying an empty FormButtons attribute will result in having an empty div HTML element with no buttons. I am not completely sure how this might be affecting the print functionality of the page. 

Is it possible for you to share additional details on how exactly the page is printed and, ideally, a sample where the defect can be observed?

Looking forward to your reply.

Kind regards,
Tsvetomir
Progress Telerik

The Premier Dev Conference is back! 

Coming to you live from Progress360 in-person or on your own time, DevReach for all. Register Today.