Vue-form-generator: Label not showing on image input

Created on 19 Jun 2017  路  14Comments  路  Source: vue-generators/vue-form-generator

Hi

The label on my image input is not showing. My code is below:

{
    type: 'image',
    label: 'Identity document',
    hideInput: true,
    preview: true,
    model: 'id_document',
    required: true,
    styleClasses: 'col-sm-12'
}

Also, is there a more detailed tutorial in styling the forms?

Thanks
Pard

bug easy before v2 stable

Most helpful comment

@icebob, @lionel-bijaoui Done, please review when you have time.

All 14 comments

Can you provide a Fiddle ?
It will be easier to find a solution that way.
Thank you.

Will do, still reading up on creating fiddles.

Hi Lionel

Hope this works. By the way, this is a great component, thanks for the great work guys.

https://jsfiddle.net/kbg6gbyc/4/

I seem to be a feature.
I didn't knew this existed and I don't know why this is here.
@icebob can you explain this choice ? I don't see the need to prevent people from adding label to a field, even if it may be a bad idea.
We should remove that, since it add limitation for no clear reason.


FYI you can add the css of VFG with this link, no need to copy and paste it directly.
I updated your fiddle accordingly.
I you want, you can start with the official fiddle next time. I may be easier.

Yes, I noticed in this piece of code:

// Should field type have a label?
            fieldTypeHasLabel(field) {
                let relevantType = "";
                if (field.type === "input") {
                    relevantType = field.inputType;
                } else {
                    relevantType = field.type;
                }

                switch (relevantType) {
                case "button":
                case "image":
                case "submit":
                case "reset":
                    return false;
                default:
                    return true;
                }

Should have just posted that actually

Thanks for the assistance lionel

You are welcome 馃憤
Next time, yeah, start with that 馃槅

Hi

Has this been updated, or is there a valid reason why an image input should not have a label?

Sorry, I'm waiting on @icebob answer to fix this (or not if it is indeed a feature that make sense).

Hmm, I think it is a bug. Need to remove the image from the switch case.

@pardmeister Could you make a PR with fix?

@icebob Not a problem.

@icebob, @lionel-bijaoui Done, please review when you have time.

Thank you. Merged.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zwx00 picture zwx00  路  3Comments

Stephen9s picture Stephen9s  路  4Comments

blackfyre picture blackfyre  路  4Comments

jaywilburn picture jaywilburn  路  3Comments

icetee picture icetee  路  4Comments