trongate / trongate-framework

The Trongate PHP framework
https://trongate.io
Other
1.11k stars 100 forks source link

Uploader displaying wrong input type. #198

Closed monxian closed 1 month ago

monxian commented 1 month ago

Uploader does not display the correct input for file uploads. In form_helpler.php this function always returns a text type input.

`function form_input(string $name, ?string $value = null, ?array $attributes = null, ?string $additional_code = null): string {     
    return generate_input_element($type, $name, $value, false, $attributes, $additional_code);
}

It needs to check the attributes for a type change, maybe something like this.

function form_input(string $name, ?string $value = null, ?array $attributes = null, ?string $additional_code = null): string {   
    if($attributes['type'){
        $type = $attributes['type'];
    } else {
        $type = 'text';
    }
    return generate_input_element($type, $name, $value, false, $attributes, $additional_code);
}
trongate commented 1 month ago

Thank you!

You'll be right. I had some AI bot do me the favor of breaking things. It must be that.

Anyway, thanks for this. I'm out just now but will check it out when I get back.

Regards,

DC

On Tue, 13 Aug 2024, 04:09 Bobby Morgan, @.***> wrote:

Uploader does not display the correct input for file uploads. In form_helpler.php this function always returns a text type input.

`function form_input(string $name, ?string $value = null, ?array $attributes = null, ?string $additional_code = null): string { return generate_input_element($type, $name, $value, false, $attributes, $additional_code); }

It needs to check the attributes for a type change, maybe something like this.

function form_input(string $name, ?string $value = null, ?array $attributes = null, ?string $additional_code = null): string { if($attributes){ $type = $attributes['type']; } else { $type = 'text'; } return generate_input_element($type, $name, $value, false, $attributes, $additional_code); }

— Reply to this email directly, view it on GitHub https://github.com/trongate/trongate-framework/issues/198, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABAUDVNNUSIIL4WPIL3XQKDZRF2IDAVCNFSM6AAAAABMNKM6POVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ3DEMRZGAZDKMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

trongate commented 1 month ago

Okay. We're good. If you use the desktop app, you'll be invited to auto-update and that'll give you the fix. Thanks for bringing this to my attention.