Cheet's profile忘了烦恼 可爱多好™PhotosBlogLists Tools Help

Blog


    August 18

    Submit a HTML form with disabled fields

    I have been trying to disable all the fields before submit, so no extra validation will be needed for the edit page.

    It is not possible to submit a DISABLED field…


    A possible solution is use READONLY attribute, but this is for textfield and textarea ONLY,  but I want all the fields to be un-changeable.

    After some research, I summerised the following techniques (hacks):


    1. The first is ugly, it involves using JavaScript on the onsubmit handler to enable all of the disabled fields. Yucky, bit some people perfer this to the next method.
    2. The second is rather easy, change the fields to readOnly instead of diabled. If you want to have the same look as disabled apply some css classes to those elements.
      Looks disabled: http://codingforums.com/showthread.php?t=13372
    3. Hidden fields: When you submit the form with the disabled fields, intercept that and  transfer all the entries into the hidden fields, and then submit that.
      http://www.faqts.com/knowledge_base/view.phtml/aid/18073

    And guess what, I’ve chosen the ugly approach, #1:

    
    
    function lockValues()
    {
           var x = elem(”Edit”).elements;
    
    	for(var i=0; i
    
    …because it is the simplest working solution~

    dhtml tree menus

    Tree menus look very good on pages, but hard to implement (well, not easy to implement) by hand, so here are some written code for building tree menus:

    Professional and Nice-looking, commerical product :(  I recommend you see the demos on their website!


    This one, simple but effective, and it has a good tutorial walking you through the process


    August 06

    JavaScript Time Picker

    The first ever Time Picker that utilize a very easy drag and drop interface. With it’s unique design, anyone can drag the minutes or hour hands independently to select a time.


    Not very easy to use, I have to say ;( Im not going to use that, but it’s good enough for JS.

    http://pttimeselect.sourceforge.net/example/index.html <- this is cool but does not have seconds & requires jQuery.



    http://home.jongsma.org/software/js/datepicker <- nice, got standalone TimePicker, but not for secs :(

    After all, I decided to do my own time picker (with sec and TZ ) using HTML….