To disable the form submit if the condition is null in the list

Confluence User - 18 Jul, 2016

How to add one validation in the list ,before submit the form?I want to do something to prevent the form submit!

The form has no onsubmit。

datalists

1


19 Jul, 2016
confluenceUser
1
confluenceUser

You can put your custom script inside Custom Footer inside your list List.

$(function(){
 
$("form:first").unbind("submit"); //unhook existing event
$("form:first").submit( function(event){
	event.preventDefault(); //prevent default form submission to handle ourselves
	
	//check for empty field in first input text field of the filter form
	if( $(this).find("input:visible:first").val() == "" ){
		alert("Please key in something to search"); //prompt error
	}else{
		DataListUtil.submitForm(this); //submit search
	}

});
 
});
RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print