×

Loading...
Ad by
  • 予人玫瑰,手有余香:加拿大新天地工作移民诚聘求职顾问&行业导师!
Ad by
  • 予人玫瑰,手有余香:加拿大新天地工作移民诚聘求职顾问&行业导师!

Actually if a programmer uses ajax a lot, that would be a nightmare to system architect. One case: A new feature needs to be added in a webpage, then a button is added, the rest of things are done by JS, ...

When you look at the page design, there is only one new button, you have to look at JS file to see, my God, it popups a new window with lots of things, and then another window is popped up if a button is clicked and other new stuffs will be displayed.

Especially in Notes, there is no new view, page, frame, ....... If you don't look at JS part, which is not integrated well into Designer tool well, you just cannot realize quickly that there is a big add-on on client side interface !!! That is out of your control !!! Programmers take a shortcut in development without noticing you the change. They successfully avoid some "trouble" from PM and architect.
Report

Replies, comments and Discussions:

  • 工作学习 / 学科技术讨论 / 我在思考如何在一个通用的web app framework 中加进web page data validation rules. 如何定义required field? 如何定义specific validation rule, ( such as: if... elseif...else....end if ) 大家有什么好主意?
    • 即便是牛年,也不要这样牛劲冲天嘛。今天是 SUNDAY, GET A LIFE!
      • 这就去auto show, 网上订票优惠10%..;-)
    • use javascript to define the rules and dynamically execute it in runtime
      • I do have a admin process to register stylesheet in database, since this is a database-driven framework. Each stylesheet has a set of local variables, its own CSS, its own resource sheet. I will do this way for data validation:
        (1) Register required field for the style sheet in database.
        (2) Read table metadata to get each field's data type.
        (3) Store general rule ( such as validating email address, phone number, datetime format ) in a XML file on server.
        (4) Store style sheet specific data validation rules in a resource file using BPML.
    • 我能想到的2种:1. client-side直接通过javascript function来做 or 2. ajax来call webservice的method。
      • (1) Using JS for data validation is definitely true. (2) If for example, an email field is on the page, using ajax's round trip to validate "@" is not necessary. My frustration is how to write a general scheme to dynamically ...
        create JS code and then let it to work on client side alone.

        I have already finished a general method for form data submission. All system has to know is SQL statement, that is all. database table, style sheet, etc, share the same namespace. Internal SQL analyzer will do the work smartly.
        • why would you need to dynamically create JS? just program the rules in JS and store it with your custom fields in your data storage, pass the JS to client side and then run it. that way you make it dynamic.
          • For a simple app with tens of pages, it is OK to program JS for each page, each event. For more complex ERP, for example, ECR app, one request may generate tens of secondary ECRs. Data validation is
            very complicated with many business rules (workflow status check, approver status check, approval process check, etc. ) getting involved, and most of them have to be done on server side. Data validation on server is OK, and is a prevailing way nowadays......But what I would like to do is to create JS on the server side based on rules already known, and submit it with html page together, let client side do the job without network traffic....it is possible.
            • no, you got my idea wrong.
              for example, you can define a validation rule in JS like:

              return ($thisField != "" && $field_001 > 100 && $field_002 < 50);

              well, this rule can be reused across different fields and even different pages.

              and yes, in this example, you can say the above script is just a template, you still need to instantiate it for the real executable.

              all depends on how you design it. hope it makes sense for you.
              • You are right, that is a good example for template. this can be designed as a normal stylesheet and included into main style sheet (or JSP), specific field names will be transferred through params. Thanks!
            • If you are using .net, you could use validatation controls(there are several different types of : required,ranged,regular-expression,custom etc) which is server-side control but rendered to client-side as javascript code.
              • Sorry, I don't know .net. Forgive this idiot:-)
        • for those pattern-based validations, just simply use the Regular Expression. only for those more complex logics or customizable logics, JS can kick in offering convenience.
      • I may define rules in a xml file and use a javascript to interpret those rules. Those two are generic. A second javascript will be used to bind rules onto pages and enforce them. Relationship between rules can be enforced in same javascript.
        • Interesting, more details please?
      • Actually if a programmer uses ajax a lot, that would be a nightmare to system architect. One case: A new feature needs to be added in a webpage, then a button is added, the rest of things are done by JS, ...
        When you look at the page design, there is only one new button, you have to look at JS file to see, my God, it popups a new window with lots of things, and then another window is popped up if a button is clicked and other new stuffs will be displayed.

        Especially in Notes, there is no new view, page, frame, ....... If you don't look at JS part, which is not integrated well into Designer tool well, you just cannot realize quickly that there is a big add-on on client side interface !!! That is out of your control !!! Programmers take a shortcut in development without noticing you the change. They successfully avoid some "trouble" from PM and architect.