• Resolved nicdimmock

    (@nicdimmock)


    Hi there
    There’s a bug that I’ve noticed in the last few days but after searching see it was reported a few weeks ago.

    A text box that is mandatory (the required flag is set) always fails the form post validation if the fields location is set to almost anywhere except “Before Add to Cart button”.

    Are you able to look into the issue or comment on an ETA or work around?
    I have quite a lot of additional fields I require from the user so would really like to position them in a product tab, but the validation always fails when they’re there.

    It’s been reported before and easy to reproduce so I’ve not supplied a URL, but if you need one please let me know.
    Many thanks for you help,
    Nic

Viewing 1 replies (of 1 total)
  • Plugin Contributor sarkparanjothi

    (@sarkparanjothi)

    Hi @nicdimmock,
    Sorry for that issue and thank you for posting this issue now only i realise new bug. I will fix this on our next release.

    If you want immediate fix.

    Goto wc-fields-facory/includes/wcff-negotiator.php in your website plugin directory to find

    private function field_rules_script_looper

    Replace the entire function like

    private function field_rules_script_looper($_rule_arr, $_field_type, $rev = false){
        	$looper_script = "";
        	foreach( $_rule_arr as $f_name => $rule ){
        		$is_check_sqr = strpos( $f_name, "[]" ) == FALSE ? "" : "[]";
        		$f_name = str_replace("[]", "", $f_name);
        		if( $rule == "hide" ){
        			$type = $rev == true ? "show" : "hide";
        			$classToggle = $type == "show" ? "removeClass" : "addClass";
        			$looper_script .= '$( "[name=\''.$f_name.'"+clone_index+"'.$is_check_sqr.'\']" ).closest(".wccpf_fields_table").'.$type.'().'.$classToggle.'("wcff_is_hidden_from_field_rule");';
        		} else if( $rule == "show" ){
        			$type = $rev == true ? "hide" : "show";
        			$classToggle = $type == "show" ? "removeClass" : "addClass";
        			$looper_script .= '$( "[name=\''.$f_name.'"+clone_index+"'.$is_check_sqr.'\']" ).closest(".wccpf_fields_table").'.$type.'().'.$classToggle.'("wcff_is_hidden_from_field_rule");';
        		}
        	}
        	return $looper_script;
        }

    And goto wc-fields-facory/assets/js/wcff-client.js find

    $(“.wccpf_fields_table:not(:visible)”).remove();

    replace this line like $(".wcff_is_hidden_from_field_rule").remove();

    i hope it will work, incense facing any issue post it here.

Viewing 1 replies (of 1 total)
  • The topic ‘from post validation always failing for mandatory text boxes’ is closed to new replies.