Get the story of the Confirm return value

Source: Internet
Author: User
Keywords Firm buttons execution resolution
Tags button buttons click content get help information internet

Perhaps a lot of people look at this title will disdain to look down, can say that more online to the issue of this article, indeed, when I encountered this problem, I also first found a lot of information on the Internet, but there is no suitable, or said not to speak clearly, and then, I asked a few cows, and several colleagues, also did not understand , later in my eldest brother's help, finally solved, so I think there is a need to write out to share the next ~

Nonsense said so much, or go straight to the theme of it ~
My request is this, the page has a form, the content of the form is bound to the database, need dynamic refresh, and then have a button--save, click to save to the database--insert_save (), there is a button submit, click to submit directly to the database Insert_ Submit (), the difference between the two is inserted into a different table, now I want to design the Save button, require 2 functions to be judged to be able to perform the insert, respectively, Ckeck_empty () and Check_formal (), That is, the detection is fully filled and the format is correct, both of these methods are completed in the background, now the task is to click the Save button, you need to pop the Confirm selection box, "Do you need to submit?", if you click Yes, perform the same actions as the Submit button, If otherwise the save operation, how can I save the value of confirm?
Many people may think so: (because the request is performed in the background)
Scriptmanager.registerstartupscript (
This. Page,
This. Page.gettype (),
This. ClientID,
"<script language=\" javascript\ "type=\" text/javascript\ ">
If confirm (' need to submit directly? ')
{
Insert_save ()
}
Else
{
Insert_submit ()
}
</script> ",
FALSE);
And then the actual operation, but found that the pop-up box to the end of the operation, that is, I did not perform the so-called query operation and directly according to the default state of the insert into the database, because it is very simple, because the first execution is the server side, and then execute the client ~ So this method can not be resolved.
Then, I saw on the Internet to save the return value to the session or cookie method, should be possible, but I have the above several functions are required to pass the other parameters (Datarow,type_name, etc.), Therefore, if you use session and cookies, these incoming parameters will not be available ~
Finally, there is no way, they had to ask the eldest brother, then the eldest brother, finally think of a little trick ———— by hiding the button to assign value to the confirm return value to the foreground: that is, put a hidden button on the page btn_hide,width set to 0, Visible is set to False, then the confirm return value in the trigger event for Save is saved to Btn_hide.value, and the insert to database action is placed into the Btn_hide triggering event, which will require incoming DR as well as type-- Name in the session, the database input operation is stored in the Btn_hide_click (), that is, by registering the hidden button event to solve the problem of transfer value ~

Maybe you may not meet the difficult situation like me, but you may also encounter, the above method is not the best solution, there must be a better way to solve the cow, here is only small white humble opinion, but also want to post and share with you ~ together with the progress ~

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.