• Resolved mbtocalli

    (@mbtocalli)


    I’m following this tutorial to create custom fields in my Awesome Support form:
    https://getawesomesupport.com/documentation-new/documentation-awesome-support-core-customization/

    However, it seems that all custom fields are set as REQUIRED even though I set up FALSE to this variable in the code.
    For instance, this code:

    wpas_add_custom_field( 'myown_field', 
    		array(
    			'title' => __( 'Custom Field #1', 'wpas' ),
    			'field_type' => 'text',
    			'required' => false
    			)
    		);

    shows me a text field in the form, but if I choose to leave it empty, I can’t send the form because it tells me that thi field cannot be empty. In fact, the code for this field looks like this:

    <input type="text" value="" id="wpas_myown_field" class="wpas-form-control" name="wpas_myown_field" required="">

    How can I add a NOT REQUIRED custom field?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Mario Peshev

    (@nofearinc)

    Hi there,

    This seems to be working on our end when registering a custom field with your code on a clear install with Awesome Support. Have you registered a single custom field, or it’s a part of several fields connected to a ticket? Also, are there other plugins interacting with the Post Edit area?

    Plugin Author Mario Peshev

    (@nofearinc)

    Hi there,

    This seems to be working on our end when registering a custom field with your code on a clean install with Awesome Support. Have you registered a single custom field, or it’s a part of several fields connected to a ticket? Also, are there other plugins interacting with the Post Edit area?

    Thread Starter mbtocalli

    (@mbtocalli)

    Hi MArio,
    there are several custom fields in the same ticket. I also have some others plugins but any interacting with the Post Edit area.

    Plugin Author awesomesupport

    (@awesomesupport)

    Hi:

    We’re unable to reproduce this issue here. Can you try this on a clean install of WP with just Awesome Support installed? Or alternatively try it on your current install with all other plugins and custom themes disabled?

    Thanks.

    Thread Starter mbtocalli

    (@mbtocalli)

    It seems that the issue was that I include this line in th as_customisations.js file:

    // Remove the required attribute when the field is hidden
    //$('#wpas_myid').prop('required', visible);

    Where #wpas_myid was the NOT REQUIRED custom field.

    I just delete it and SOLVED the issue!
    Thanks!

    Plugin Author awesomesupport

    (@awesomesupport)

    Hi:

    Glad you figured it out!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Not Required custom fields’ is closed to new replies.