1,

/* Common methods of encapsulating operation forms */
// Get the data to save wjh 2015-10-22
function getSaveData(className) {
if (className == null) {
className = "savedata";
}
var model = new Object();
// Always add class="savedata" Will be added to the object
// Be careful not to write a label many times class="" , This will only take the first
$("." + className).each(function () {
var id = $(this).attr("id");
model[id] = $(this).val(); });
return model;
} // in the light of class=required Detect required fields , Pass the test and return true, Failure to return false
function required(message) {
if (message == null) {
message = " Required ";
}
var flag = true;
// Always add class="savedata" Will be added to the object
// Be careful not to write a label many times class="" , This will only take the first
$(".required").each(function () {
var val = $(this).val();
if (val == null || val == "") {
if (!$(this).next().hasClass('requiredmessage')) {
$(this).after(' <span class="requiredmessage" style="color:Red;"> Required </span>');
}
flag = false;
} else {
if ($(this).next().hasClass('requiredmessage')) {
$(this).next().remove();
}
}
});
return flag;
}

form More articles on operation

  1. Django( 8、 ... and ) Next :Model Operation and Form operation 、 Serialization operation

    Two .Form operation It usually creates forms.py file , Separate storage form modular . Form Specialized in data validation , And it's very powerful . There are two plug-ins : fields : verification ( It's going to work ) widgets: Generate HTML( Yes ...

  2. Django( 8、 ... and ) On :Model Operation and Form operation

    ↑↑↑ Click on the top ”+” Expand the table of contents Model and Form as well as ModelForm brief introduction Model operation : Create database table structure Operate database tables Do some validation Form operation : data validation ( Powerful ) ModelForm ...

  3. Python The way -(Django(csrf, middleware , cache , The signal ,Model operation ,Form operation ))

    csrf middleware cache The signal Model operation Form operation csrf: use django How long has it been , I talk to csrf I've been dealing with this concept for a long time . Every time you initialize a project, you see django.middlewa ...

  4. flask, SQLAlchemy, sqlite3 Realization RESTful API Of todo list, Support at the same time form operation

    flask, SQLAlchemy, sqlite3 Realization RESTful API, Support at the same time form operation . The interaction between the front end and the background adopts json data format , Native javascript Realized ajax. The main technical points are as follows ...

  5. Day23-Model Operation and Form operation - Reprint

    Reference source : http://blog.csdn.net/fgf00/article/details/54614706 Model and Form as well as ModelForm brief introduction Model operation : Create database table structure ...

  6. Day23-Model operation ,Form Operations and serialization operations

    Reference sources :http://blog.csdn.net/fgf00/article/details/54629502 1. Please refer to :http://www.cnblogs.com/momo8238 ...

  7. Django The foundation form operation

    Form The function of forms Automatic generation HTML Form Elements Check the validity of form data If the validation error , Redisplay the form ( The data will not reset ) Data type conversion ( Character type data is converted to the corresponding Python type ) Form Related objects include Wi ...

  8. django(6)model TABLE statement operations 、Form operation 、 Serialization operation

    1.model Create index of table operation . Metadata # Single table operation , Create table class User(models.Model): name = models.CharField(max_length=32) ema ...

  9. Django And Form operation

    One .Form Basics ( One )Form The role of Django Of Form It has the following functions : Generate HTML label Validate user data ( Display error message ) Form Submit keeps the last submitted data Initialize page display data ( Two ) example General network ...

Random recommendation

  1. 【 Crazy wheels -iOS】JSON turn Model The second series

    [ Crazy wheels -iOS]JSON turn Model The second series Please indicate the source of this article —— polobymulberry- Blog Garden 1. Preface Last one <[ Crazy wheels -iOS]JSON turn Model One of series > ...

  2. phpexcel introduce MVC The framework leads to __autoload Solutions to the failure of importing class files

    Autoloader.php Of register and load Method register Method if (function_exists('__autoload')) { // Register any exis ...

  3. [NOIP2014] Improvement group Luogu P2296 Find the way

    Title Description In digraph G in , The length of each edge is 1 , Now, given the starting point and the ending point , Please find a path from the beginning to the end in the picture , The path satisfies the following conditions : 1 . All the points on the path are directly or indirectly connected with the end point . 2 . In the satisfaction bar ...

  4. js Format date Specific date

    /**                     * Format date                      * @param value                     * @param row  ...

  5. Linux Methods to configure global environment variables

    summary 3 Methods : 1. modify /etc/profile    1.1 : First, set the environment variables in this file ;    1.2:export  Set environment variables .  #view /etc/profile export ...

  6. [ Arrangement ]Svn FAQ summary .

    1.’.’ is not a working copy.Can’t open file‘.svn/entries’:  The system could not find the specified path . answer : The reason is that the access path entered is incorrect , Such as svn://192.1 ...

  7. uvalive 3971 Assemble

    https://vjudge.net/problem/UVALive-3971 The question : Now you're going to assemble a computer , Every computer has a variety of options for one type of accessory , Their names are different . Now we present the existing components , Each type is different ...

  8. from PRISM Start learning WPF( 6、 ... and )MVVM( 3、 ... and ) Event aggregator EventAggregator?

    from PRISM Start learning WPF( One )WPF? from PRISM Start learning WPF( Two )Prism? from PRISM Start learning WPF( 3、 ... and )Prism-Region? from PRISM Start learning WPF( Four )Prism-Module? ...

  9. JavaWeb In the online mall project sql The solution of sentence problem

    What happened resolvent Yes ProductDaoImpl establish Junit Test to get the problem Learned Junit case Test verification and debug Step by step mysql Is a relational database .Redis It's a non relational database, and it's better than m ...

  10. browser h5 New file Save to local ( It's like a browser writing a file )

    function doSave(value, type, name) {         var blob;         if (typeof window.Blob == "funct ...