"Amazeui" amazeui box with a fatal flaw in the OK box

Source: Internet
Author: User

In Amazeui this mobile front-end framework can be used in the following script:

function calculate () {    $ (' #confirm1 '). Modal ({    });}

To trigger a confirmation box in HTML that has the following layout:

<div class= "Am-modal am-modal-alert" tabindex= "-1" id= "Confirm1" >      <div class= "Am-modal-dialog" >          <div class= "am-modal-bd" > OK box contents </div>        <div class= "Am-modal-footer" >              <span class= "Am-modal-btn" data-am-modal-confirm> OK </span>              <span class= "Am-modal-btn" Data-am-modal-cancel > Cancel </span>               </div>      </div></div>

This confirmation box has been described in detail in the "Amazeui" embedded form in the modal box, forming the Modal input box (click the Open link). Here is an example that focuses on the fatal flaw of this deterministic box.

An HTML layout such as the following:

<!--develop--><!doctype html>A script like the following:

<script>function calculate () {var num1=$ ("#num1"). Val (), Var num2=$ ("#num2"). Val (); if (IsNaN (NUM1) | | IsNaN (num2) | |! num1| |! NUM2)  alert ("Any one is not a number!") ");  else{  var result=parsefloat (NUM1) +parsefloat (num2);}  $ (' #confirm1 '). Modal ({onconfirm:function () {alert ("Num1 value:" +NUM1); alert ("Num2 value:" +num2); $ ("#result"). HTML ( result);}}); </script>
Originally wanted to achieve the following effect, do an adder, after doing the addition, give the user a hint, ask whether to calculate?


But the actual running results you see, the first time you run, the script gets the value is correct, but the second run is the first time to run the value.

According to Amazeui's official website, it is because of performance-based considerations that the modal box only holds values for the first run . This is very deadly! As some of the above occasions, before the user to increase the deletion of the search, I hope to determine the first way to ask the user whether to perform the operation, but, due to the so-called performance considerations such as Amazeui, resulting in the failure to achieve the effect of multiple update function values.

Although the official website puts forward the setting by relatedtarget this hook to get the data, the element for the bridge to get the desired data a series of ways (click to open the link)

But the actual operation is not ideal, at least after setting up the Relatedtarget, it is not possible to interact with Ajax correctly.

I once thought that it would be possible to write such a line:

<script>function Calculate () {$ (' #confirm1 '). Modal ({oncancel:function () {return false;}}); /write what you want to do ...} </script>
However, this does not have any eggs ... No wait for the user to click OK, then the following content is executed. Not like alert (); Interrupt script.

This dialog box is not as good as JavaScript, compatible with any browser dialog, this dialog box in the UC, mobile phone comes with the browser effective, visual effect is not bad.

if (Confirm ("hint box content")) {//content after the user point is determined}else{//the content after the user point is canceled}

I don't know what happened to Amazeui? What is based on performance considerations? Clearly even the function has not been realized, on the performance considerations, I can only hehe the harm I thought is backstage those divine level what caching mechanism and Ajax out of the question. Actually there is the elimination of the scope of the practice, simply does not conform to the concept of programming.

"Amazeui" amazeui box with a fatal flaw in the OK box

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.