Support » Plugin: Wp-Pro-Quiz » Customs fields variables , the required text displays before submitting the form

  • Resolved preetee


    Dear all,

    Am a newbie in wordpress, I have installed the plugin and customised it to my theme. It worked fine but i have an issue with required field for the registration form.Is it possible to display the error message only on clicking the “start quiz” button of the form only.

    Right now, it display the message “You must specify a text.” below the input field before even submitting the form .
    In the wpProQuiz_front.js, it check if the required text if is required and empty , if so , then it create the invalid message for that input field type.

    this.checkForm = function() {
    				var check = true;
    				$e.find('.wpProQuiz_forms input, .wpProQuiz_forms textarea, .wpProQuiz_forms .wpProQuiz_formFields, .wpProQuiz_forms select').each(function() {
    					var $this = $(this);
    					var isRequired = $'required') == 1;
    					var type = $'type');
    					var test = true;
    					var value = $.trim($this.val());
    					switch (type) {
    					case typeConst.TEXT:
    					case typeConst.TEXTAREA:
    					case typeConst.SELECT:
    							test = !funcs.isEmpty(value);
    					case typeConst.NUMBER:
    						if(isRequired || !funcs.isEmpty(value))
    							test = !funcs.isEmpty(value) && !isNaN(value);
    					case typeConst.EMAIL:
    						if(isRequired || !funcs.isEmpty(value))
    							test = !funcs.isEmpty(value) && new RegExp(/^[a-z0-9!#$%&'*+\/=?^_<code>{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_</code>{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/)
    					case typeConst.CHECKBOX:
    							test = $':checked');
    					case typeConst.YES_NO:
    					case typeConst.RADIO:
    							test = $this.find('input[type="radio"]:checked').val() !== undefined;
    					case typeConst.DATE:
    						var num = 0, co = 0;
    						$this.find('select').each(function() {
    							co += funcs.isEmpty($(this).val()) ? 0 : 1;
    						if(isRequired || co > 0)
    							test = num == co;
    					if(test) {
    					} else {
    						check = false;

    Thank you for your kind help. Any helpfull response is greatly appreciated as i need to submit this project today 🙁

Viewing 1 replies (of 1 total)
  • You must deactivate the autostart option O.o simply so that invalid messages dont show up even before clicking on the start quiz button for register user form

Viewing 1 replies (of 1 total)
  • The topic ‘Customs fields variables , the required text displays before submitting the form’ is closed to new replies.