• Resolved streamworksaudio

    (@streamworksaudio)


    Hi,

    I used the function dokan_post_input_box() to a few custom fields to the new product page form and have some custom functions to handle the posted data. But I am wondering how can I make some of these required?

    The dokan_post_input_box() function does support ‘required’ on some of the input types, but I have a couple radio buttons and that function does not a required attribute that can be passed to it. Any ideas on how I can force the selection of one of these radio buttons in the group?

    Cheers

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter streamworksaudio

    (@streamworksaudio)

    After digging on this for the last couple hours and looking over the source code I can see that it would hard to have the custom field verified on the server side.

    As suggestion for an update would be to put a hook on the function handle_product_add() near the top after the $error array is defined (call it something like dokan_before_new_product_added something like that. From here developers can use that hook to have any custom fields that might have been created verified and add any errors that might be needed.

    Just a thought. For now the only way I can see doing this would have to be client side and disable the ‘Add New’ button unless one of the radio options have been checked.

    Hi @streamworksaudio,

    You can read the article to know how to make a field required of the Dokan product form.

    Thank you!

    Thread Starter streamworksaudio

    (@streamworksaudio)

    Hi Tanjir,

    Perfect! The dokan_can_add_product filter is what I needed. I am not able to validate my custom fields.

    Thanks for your help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom input on new product – make it required’ is closed to new replies.