The controller receives less than js-past ID

Development tools and key technologies: Visual Studio
Author: Xiaoguang Bin
wrote Time: May 21, 2019

About this little detail, many people may have encountered this problem is obviously js get to the data page, but not pass the controller, especially the data ID does not pass in the past, this is because it is often hidden fields the problem, then, I am concerned about my problems
Here Insert Picture Description
Here Insert Picture Description
first, here are two different forms, different modalities box hidden field, but connected to the B table a table, table B need to use ID a table as foreign keys, so it is necessary to receive the ID a table, where you can see, B table need to use ID a table, a hidden field ID is unique, is certainly not the same, but the name is not the same here , I get to look at the data
Here Insert Picture Description
Here Insert Picture Description
here is I get to the hidden field inside the ID data can be found, if we need to use table B ID a table, then we get the data can not be empty, and here is empty, if data acquisition js less than a page, it is certainly not pass the controller over there, then the key question is where? Lies hidden inside the field name, if B is the need to use the table as a foreign key table A, then B table as the foreign key hidden domain name must keep hidden fields in Table A of the same name, while A table keep the name of the database name to be consistent, so that is when we set up the hidden domain name, to be named according to the database, otherwise it is not receiving data
Here Insert Picture Description
Here Insert Picture Description
which I put into a hidden field with the same name after the acquisition database data, when the name a table with a hidden field B table as hidden field name, then B will be able to get to the table ID a table, and can spread to the controller, the small details really are not careful really hard to find out, I have personally experienced, so pay attention to it! ! !
Not just hidden fields, other input tag inside the name also keep a database corresponds to the page in order to receive pass over the data, so they can not get the data of the problem often because we are named in html in the wrong name inconsistent, leading to the reception less than data or received data inconsistencies, data error occurs.

Guess you like

Origin blog.csdn.net/qq_44505797/article/details/90632115
Recommended