Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to set static text item value in response to change on other form item

    Posted on behalf of user Sabir
    --------------------
    Hi All,
    as i need to display the date and the day in the static textbox .for the next date which i have selected in the the date time picker. for eg :- if i have selected the date 22-apr-2007.
    in the first static text :-it should dispaly me :-mon 23-apr-2007,
    in the next statictext :-it should dispaly me :-tue 24-apr-2007,

    #2
    Hi Sabir,
    It sounds like you have a dynamicForm containing (at least) 3 items: a dateItem and 2 staticTextItems, and when the user selects a date from the date item, you want to show the next 2 days as text in the staticTextItems.

    You should be able to achieve this via a change handler on the date item, which sets the values of the 2 staticTextItems.
    Here's an example that you can use as a starting point:

    Code:
    isc.DynamicForm.create({
        ID:'dateForm',
        items:[
            {name:"dateItem", type:"date",
             change:function (form,item,value,oldValue) {
                 var nextDay = new Date(),
                     dayAfter = new Date();
                 nextDay.setTime(initialDate.getTime() + 86400000);
                 dayAfter.setTime(initialDate.getTime() + (2*86400000));
    
                 form.setValue("nextDay", nextDay.toNormalString());
                 form.setValue("dayAfter", dayAfter.toNormalString());
             },
             {name:"nextDay", shouldSaveValue:false, type:"staticText"},
             {name:"dayAfter", shouldSaveValue:false, type:"staticText"}
            }
        ]
    })

    In addition to this, if you need to manage the format displayed in the static text items, you can pass any of the standard date formatters directly into the 'toNormalString()' call, or for a custom formatter, pass in a function that will fire in the scope of the date object, and return string to be displayed

    Hope this helps

    Isomorphic Software

    Comment

    Working...
    X