5

how to add contents in placeholder like static with dynamic contents.

asked 2013-07-26 10:03:43 +0800

jaideep gravatar image jaideep flag of India
178 5

e.g.:<doublebox maxlength="10" mandatory="@load(something.valueRequired)" width="250px" tooltiptext="Enter Number" value="@bind(something.infoNumericValue)" placeholder="@load(something.infoData);"> </doublebox> So,please tell me how to add `

enter with dynamic content(@load(something.infoData))`

and it is shown like enter your something in placeholder.

delete flag offensive retag edit

2 Answers

Sort by » oldest newest most voted
1

answered 2013-07-26 12:41:48 +0800

nsharma gravatar image nsharma flag of India
917 1 11

updated 2013-07-29 06:07:10 +0800

You can use EL expressions for this:-

  placeholder="Enter ${something.infoData}"

anything you write in EL expression needs to be loaded previously into zul.So make sure the object is already loaded


link publish delete flag offensive edit
0

answered 2013-07-30 08:22:43 +0800

khcyt gravatar image khcyt
216 1 1

You can also use ZK Bind. See example below.

Kai

<?xml version="1.0" encoding="UTF-8"?>

<zk> <zscript>

    class A
    {
        public A(String s, Long v, Boolean is_group)                    { s_= s; v_= v; is_group_= is_group; }

        public String getLabel()        { return s_; }
        public void setLabel(String s)  { s_=s; }
        public Boolean isGroup()        { return is_group_; }
        public Long getValue()          { return v_; }
        public String getPlaceholder()  { return "Please type some text"; }

        String s_= null;
        Long v_= null;
        Boolean is_group_= null;
    }

    lm.add(new A("Today", 1L, Boolean.TRUE));
    lm.add(new A("RE: Bandbox Autocomplete Problem", 2L, Boolean.FALSE));
    lm.add(new A("", 3L, Boolean.FALSE));
    lm.add(new A("RE: FileUpload", 4L, Boolean.FALSE));
    lm.add(new A("", 5L, Boolean.FALSE));

    lm.add(new A("Yesterday", 10L, Boolean.TRUE));
    lm.add(new A("", 11L, Boolean.FALSE));
    lm.add(new A("RE: SelectedItemConverter Question' ite", 12L, Boolean.FALSE));

    lm.add(new A("Last week", 100L, Boolean.TRUE));
    lm.add(new A("RE: Times_Series Chart help", 101L, Boolean.FALSE));
    lm.add(new A("", 102L, Boolean.FALSE));

    class VM
    {
        public ListModel getListModel()     { return lm; } 
    }
]]></zscript>

<window id="win" title="Window ZK6 dynamic template" border="normal" width="600px" 
        apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('VM')" >                 
    <listbox model="@bind(vm.listModel) @template(each.isGroup() ? 'group_model' : 'item_model')">
        <listhead>
            <listheader hflex="3" label="Column 1"/>
            <listheader hflex="1" label="Column 2"/>
        </listhead>
        <template name="group_model">
            <listgroup open="true" label="@load(each.label)"/>
        </template>
        <template name="item_model">
            <listitem vflex="1">
                <listcell>
                    <textbox hflex="1" placeholder="@init(each.placeholder)" value="@bind(each.label)"/>
                </listcell>
                <listcell>
                    <label value="@load(each.value)"/>
                </listcell>
            </listitem>
        </template>
    </listbox>
</window>

</zk>

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2013-07-26 10:03:43 +0800

Seen: 55 times

Last updated: Jul 30 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More