• Resolved Malae

    (@malae)


    Hello Guido,

    I just ran the HTML5 validation on my site and got two warnings about duplicate IDs:

    Error: Duplicate ID vscf_privacy. 
    From line 713, column 11; to line 713, column 115
    <label><input type="checkbox" name="vscf_privacy" id="vscf_privacy" class="custom-control-input" value="yes"  /> <span
    
    Warning: The first occurrence of ID vscf_privacy was here. 
    From line 712, column 4; to line 712, column 73
    roup">?			<input type="hidden" name="vscf_privacy" id="vscf_privacy" value="no">?			<l
    
    Error: Duplicate ID vscf_widget_nonce.
    From line 716, column 4; to line 716, column 93
    hide">?			<input type="hidden" id="vscf_widget_nonce" name="vscf_widget_nonce" value="bca686855a" /><input
    
    Warning: The first occurrence of ID vscf_widget_nonce was here.
    From line 684, column 329; to line 684, column 418
    t us.</h2><input type="hidden" id="vscf_widget_nonce" name="vscf_widget_nonce" value="bca686855a" /><input

    These seem to be thrown by the code in lines 335 and 336 in the vscf-form.php

    Can this be fixed?

    • This topic was modified 6 years, 9 months ago by Malae.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Guido

    (@guido07111975)

    Hi,

    I don’t think I can solve this completely..

    The first one is the privacy checkbox and in order to make it work properly (best practice) I had to add a hidden field with the same ID as the visible field:

    
    <input type="hidden" name="vscf_privacy" id="vscf_privacy" value="no">
    

    The second one is related to the nonce and this is done by WordPress itself. I only have to add the nonce and WordPress does the rest.

    First I set the nonce:

    
    $nonce = wp_nonce_field( 'vscf_nonce_action', 'vscf_nonce' );
    

    And elsewehere I call it:

    
    '. $nonce .'
    

    Guess that’s why the duplicate error comes from. Can try to solve that one.

    Thanks for informing me.

    Guido

    Plugin Author Guido

    (@guido07111975)

    Hi again,

    Wil fix the second duplicate ID when updating plugin. Made a minor mistake while adding the so called nonce field to my plugin (it’s echoed twice).

    Guido

    Thread Starter Malae

    (@malae)

    Thanks Guido for your quick response.

    Plugin Author Guido

    (@guido07111975)

    Hi again,

    Can and will fix both errors. The first one can be fixed easily as well. So there will be an plugin update this week.

    Guido

    Thread Starter Malae

    (@malae)

    Good, goed, buono! ??

    Plugin Author Guido

    (@guido07111975)

    Have updated plugin few moments ago. The HTML5 validation should be fine now.

    Guido

    Thread Starter Malae

    (@malae)

    Looks good, thank you Guido!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Duplicate IDs’ is closed to new replies.