• Resolved Simon Harvey

    (@s_t_harvey)


    Hello,

    I am having trouble with this plugin.

    It has been working well until recently.

    In the Smart Forms backend, when creating a form, I am specifying ID and Class of a field however this isn’t showing up on the form.

    Do you know what is going wrong with this?

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author EDGARROJAS

    (@edgarrojas)

    hello, so the id and class are not added to the field in the html code that is generated?

    And if so could you tell me which field is having this issue, what class and id are you trying to add and give me a link to your form please?

    Regards!

    Thread Starter Simon Harvey

    (@s_t_harvey)

    Thanks a lot,

    I have only tested this on text fields and select fields and it isn’t showing up on either.

    I can’t show a link I’m afraid as this is on an internal site.

    I’m am trying to add the id “newname”.

    I have checked the sourcode and can see that the ID isn’t used in the HTML output:

     startOfInput+
    
                        '<input style="'+additionalStyle+'" '+(this.Options.ReadOnly=='y'?'disabled="disabled"':"")+' name="'+this.GetPropertyName()+'" type="text" placeholder="'+RedNaoEscapeHtml(this.Options.Placeholder)+'" class="form-control redNaoInputText '+(this.Options.ReadOnly=='y'?'redNaoDisabledElement':"")+'" value="'+RedNaoEscapeHtml(this.Options.Value)+'">'+
    
                        endOfInput+

    I have edited this now so that it includes

    id="'+RedNaoEscapeHtml(this.Options.Id)+'"

    This is now working for me with this edit (I’m not too concerned about the class).

    Thanks,

    Simon

    Plugin Author EDGARROJAS

    (@edgarrojas)

    Ok, the classes and ids are actually added in the parent container (the root container of each field).

    Regards!

    Thread Starter Simon Harvey

    (@s_t_harvey)

    Ok thanks for that – this isn’t happening for me either – but never mind as I have it working how I wish.

    Wouldn’t it be more useful to have an ID on the field element so that it can be manipulated with JS if required? E.G. I am using it so that the fields are populated with data from a DB that is queried with PHP and output passed to the form via JS.

    Cheers

    Thread Starter Simon Harvey

    (@s_t_harvey)

    Correction – the ID is being displayed on the root element of the field for me.

    Plugin Author EDGARROJAS

    (@edgarrojas)

    Great.

    Regarding wouldn’t it be more useful to have an ID on the field element so that it can be manipulated with JS if required.

    I think that depends on the use case, the field is not only the input box, it is also the label, some users wants to manipulate the label and not the input box, some want to manipulate both. Having the id directly in the root container let you manipulate every aspect of the field, if you are using jquery for example, you could easily fill the field with a code like this: jQuery(‘#fieldid input’).val(‘value’);

    Regards!

    Thread Starter Simon Harvey

    (@s_t_harvey)

    Ah great, that’s much easier, thanks so much for your assistance!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Field ID & Class not working’ is closed to new replies.