• Resolved arbremojo

    (@arbremojo)


    Hi,

    I have several custom fields in Ultimate Member account, which are required. But when submitting, even if these values aren’t filled, you can save the form.

    Do you know why?

    Thank you,

    Clara.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @arbremojo ,

    Is the field required setting enabled? Go to wp-admin>Ultimate Member> Forms> Edit a Form> Edit the field. https://screenbud.com/s/z3lLkel316G

    Make sure to also enable the “Apply custom settings to this form” under customize this form section. https://screenbud.com/s/cXnhJGGohdT

    Thread Starter arbremojo

    (@arbremojo)

    Hi,

    Yes I did that. They all have an asterisk, but they are not required at the submit though.

    I’m talking about “account” form, not “profile” form.

    Plugin Support Aswin Giri

    (@aswingiri)

    Hello @arbremojo

    Can you please try validating data as in example code below:

    add_action( 'um_submit_account_errors_hook', function($form_data){
    
    	$tab = sanitize_key( $form_data['_um_account_tab'] );
    
    	if ( isset( $form_data['phone_number'] ) && ( strlen( trim( $form_data['phone_number'] ) ) === 0 ) ) {
    		UM()->form()->add_error( 'phone_number', __( 'Phone number is required', 'ultimate-member' ) );
    		return;
    	}
    
    	UM()->account()->current_tab = $tab;
    });
    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hey there!

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. ??

    Regards,

    Thread Starter arbremojo

    (@arbremojo)

    Hi,

    I’m sorry I didn’t replied, it actually worked!

    Thank you!!

    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @arbremojo

    Thanks for letting us know.

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