001/**
002 *
003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
004 *
005 * This library is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU Lesser General Public
007 * License as published by the Free Software Foundation; either 
008 * version 2.1 of the License, or (at your option) any later version.
009 * 
010 * This library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013 * Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public 
016 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
017 * 
018 **/
019package lucee.runtime.tag;
020
021import java.io.IOException;
022import java.util.Iterator;
023import java.util.Map.Entry;
024
025import javax.servlet.jsp.tagext.Tag;
026
027import lucee.commons.lang.HTMLEntities;
028import lucee.commons.lang.StringUtil;
029import lucee.runtime.exp.ApplicationException;
030import lucee.runtime.exp.ExpressionException;
031import lucee.runtime.exp.PageException;
032import lucee.runtime.ext.tag.TagImpl;
033import lucee.runtime.op.Caster;
034import lucee.runtime.op.Decision;
035import lucee.runtime.type.Array;
036import lucee.runtime.type.Collection.Key;
037import lucee.runtime.type.Struct;
038import lucee.runtime.type.StructImpl;
039import lucee.runtime.type.util.KeyConstants;
040import lucee.runtime.type.util.ListUtil;
041
042// FUTURE tag input 
043//attr validateAt impl tag atrr
044//attr validate add support for submitOnce
045// Added support for generating Flash and XML controls (specified in the cfform tag).
046// Added support for preventing multiple submissions.
047// attr mask impl. logik dahinter umsetzen
048
049/**
050 * 
051 */
052public class Input extends TagImpl {
053    
054    public static final short TYPE_SELECT=-1;
055        public static final short TYPE_TEXT=0;
056    public static final short TYPE_RADIO=1;
057    public static final short TYPE_CHECKBOX=2;
058    public static final short TYPE_PASSWORD=3;
059    public static final short TYPE_BUTTON=4;
060    public static final short TYPE_FILE=5;
061    public static final short TYPE_HIDDEN=6;
062    public static final short TYPE_IMAGE=7;
063    public static final short TYPE_RESET=8;
064    public static final short TYPE_SUBMIT=9;
065    public static final short TYPE_DATEFIELD=10;
066        
067    public static final short VALIDATE_DATE=4;
068    public static final short VALIDATE_EURODATE=5;
069    public static final short VALIDATE_TIME=6;
070    public static final short VALIDATE_FLOAT=7;
071    public static final short VALIDATE_INTEGER=8;
072    public static final short VALIDATE_TELEPHONE=9;
073    public static final short VALIDATE_ZIPCODE=10;
074    public static final short VALIDATE_CREDITCARD=11;
075    public static final short VALIDATE_SOCIAL_SECURITY_NUMBER=12;
076    public static final short VALIDATE_REGULAR_EXPRESSION=13;
077    public static final short VALIDATE_NONE=14;
078
079    public static final short VALIDATE_USDATE=15;
080    public static final short VALIDATE_RANGE=16;
081    public static final short VALIDATE_BOOLEAN=17;
082    public static final short VALIDATE_EMAIL=18;
083    public static final short VALIDATE_URL=19;
084    public static final short VALIDATE_UUID=20;
085    public static final short VALIDATE_GUID=21;
086    public static final short VALIDATE_MAXLENGTH=22;
087    public static final short VALIDATE_NOBLANKS=23;
088    // TODO SubmitOnce
089
090    /**
091     * @param validate The validate to set.
092     * @throws ApplicationException
093     */
094    public void setValidate(String validate) throws ApplicationException {
095        validate=validate.toLowerCase().trim();
096        if(validate.equals("creditcard"))               input.setValidate(VALIDATE_CREDITCARD);
097        else if(validate.equals("date"))                input.setValidate(VALIDATE_DATE);
098        else if(validate.equals("usdate"))              input.setValidate(VALIDATE_USDATE);
099        else if(validate.equals("eurodate"))    input.setValidate(VALIDATE_EURODATE);
100        else if(validate.equals("float"))               input.setValidate(VALIDATE_FLOAT);
101        else if(validate.equals("numeric"))             input.setValidate(VALIDATE_FLOAT);
102        else if(validate.equals("integer"))             input.setValidate(VALIDATE_INTEGER);
103        else if(validate.equals("int"))                 input.setValidate(VALIDATE_INTEGER);
104        else if(validate.equals("regular_expression"))          input.setValidate(VALIDATE_REGULAR_EXPRESSION);
105        else if(validate.equals("regex"))               input.setValidate(VALIDATE_REGULAR_EXPRESSION);
106        else if(validate.equals("social_security_number"))input.setValidate(VALIDATE_SOCIAL_SECURITY_NUMBER);
107        else if(validate.equals("ssn"))                 input.setValidate(VALIDATE_SOCIAL_SECURITY_NUMBER);
108        else if(validate.equals("telephone"))   input.setValidate(VALIDATE_TELEPHONE);
109        else if(validate.equals("phone"))               input.setValidate(VALIDATE_TELEPHONE);
110        else if(validate.equals("time"))                input.setValidate(VALIDATE_TIME);
111        else if(validate.equals("zipcode"))             input.setValidate(VALIDATE_ZIPCODE);
112        else if(validate.equals("zip"))                 input.setValidate(VALIDATE_ZIPCODE);
113
114        else if(validate.equals("range"))               input.setValidate(VALIDATE_RANGE);
115        else if(validate.equals("boolean"))             input.setValidate(VALIDATE_BOOLEAN);
116        else if(validate.equals("email"))               input.setValidate(VALIDATE_EMAIL);
117        else if(validate.equals("url"))                 input.setValidate(VALIDATE_URL);
118        else if(validate.equals("uuid"))                input.setValidate(VALIDATE_UUID);
119        else if(validate.equals("guid"))                input.setValidate(VALIDATE_GUID);
120        else if(validate.equals("maxlength"))   input.setValidate(VALIDATE_MAXLENGTH);
121        else if(validate.equals("noblanks"))    input.setValidate(VALIDATE_NOBLANKS);
122        
123        else throw new ApplicationException("attribute validate has an invalid value ["+validate+"]",
124                "valid values for attribute validate are [creditcard, date, eurodate, float, integer, regular, social_security_number, telephone, time, zipcode]");
125        
126    }
127    
128    
129        public static final String[] DAYNAMES_DEFAULT = new String[]{"S", "M", "T", "W", "Th", "F", "S"};
130        public static final String[] MONTHNAMES_DEFAULT = new String[]{"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
131        
132
133    Struct attributes=new StructImpl();
134    InputBean input=new InputBean();
135    String passthrough;
136        
137    String[] daynames=DAYNAMES_DEFAULT;
138    String[] monthnames=MONTHNAMES_DEFAULT;
139    
140    boolean enabled=true;
141    boolean visible=true;
142    String label;
143    String tooltip;
144    String validateAt;
145        double firstDayOfWeek=0;
146        String mask;
147        
148    
149    @Override
150    public void release() {
151        super.release();
152        input=new InputBean();
153        attributes.clear();
154        passthrough=null;
155
156        daynames=DAYNAMES_DEFAULT;
157        monthnames=MONTHNAMES_DEFAULT;
158        enabled=true;
159        visible=true;
160        label=null;
161        tooltip=null;
162        validateAt=null;
163        firstDayOfWeek=0;
164        mask=null;    
165    }
166    
167    /**
168     * @param cssclass The cssclass to set.
169     */
170    public void setClass(String cssclass) {
171        attributes.setEL("class",cssclass);
172    }
173    /**
174     * @param cssstyle The cssstyle to set.
175     */
176    public void setStyle(String cssstyle) {
177        attributes.setEL("style",cssstyle);
178    }
179   /**
180     * @param id The id to set.
181     */
182    public void setId(String id) {
183        attributes.setEL("id",id);
184    }
185    
186    public void setAccept(String accept) {
187        attributes.setEL("accept",accept);
188    }
189    
190    public void setAccesskey(String accesskey) {
191        attributes.setEL("accesskey",accesskey);
192    }
193    
194    public void setAlign(String align) {
195        attributes.setEL("align",align);
196    }
197    
198    public void setAlt(String alt) {
199        attributes.setEL("alt",alt);
200    }
201
202
203    public void setAutocomplete(String autocomplete) {
204        attributes.setEL("autocomplete",autocomplete);
205    }
206    public void setAutofocus(String autofocus) {
207        attributes.setEL("autofocus",autofocus);
208    }
209    
210
211        public void setBorder(String border) {
212        attributes.setEL("border",border);
213    }
214    
215    public void setDatafld(String datafld) {
216        attributes.setEL("datafld",datafld);
217    }
218    
219    public void setDatasrc(String datasrc) {
220        attributes.setEL("datasrc",datasrc);
221    }
222
223    public void setForm(String form) {
224        attributes.setEL("form",form);
225    }
226    public void setFormaction(String formAction) {
227        attributes.setEL("formaction",formAction);
228    }
229    public void setFormenctype(String formenctype) {
230        attributes.setEL("formenctype",formenctype);
231    }
232    public void setFormmethod(String formmethod) {
233        attributes.setEL("formmethod",formmethod);
234    }
235    public void setFormnovalidate(String formnovalidate) {
236        attributes.setEL("formnovalidate",formnovalidate);
237    }
238    public void setFormtarget(String formtarget) {
239        attributes.setEL("formtarget",formtarget);
240    }
241    
242
243    public void setLang(String lang) {
244        attributes.setEL("lang",lang);
245    }
246    public void setList(String list) {
247        attributes.setEL("list",list);
248    }
249    
250    public void setDir(String dir) {
251        //dir=dir.trim();
252        //String lcDir=dir.toLowerCase();
253        //if( "ltr".equals(lcDir) || "rtl".equals(lcDir)) 
254                attributes.setEL("dir",dir);
255        
256        //else throw new ApplicationException("attribute dir for tag input has an invalid value ["+dir+"], valid values are [ltr, rtl]");
257    }
258    
259    public void setDataformatas(String dataformatas) {
260        dataformatas=dataformatas.trim();
261        //String lcDataformatas=dataformatas.toLowerCase();
262        //if( "plaintext".equals(lcDataformatas) || "html".equals(lcDataformatas)) 
263                attributes.setEL("dataformatas",dataformatas);
264        
265        //else throw new ApplicationException("attribute dataformatas for tag input has an invalid value ["+dataformatas+"], valid values are [plaintext, html");
266    }
267
268    public void setDisabled(String disabled) {
269        // alles ausser false ist true
270        //if(Caster.toBooleanValue(disabled,true)) 
271                attributes.setEL("disabled",disabled);
272    }
273
274    public void setEnabled(String enabled) {
275        // alles ausser false ist true
276        //setDisabled(Caster.toString(!Caster.toBooleanValue(enabled,true))); 
277                attributes.setEL("enabled",enabled);
278    }
279    
280    
281    
282    
283    public void setIsmap(String ismap) {
284        // alles ausser false ist true
285        //if(Caster.toBooleanValue(ismap,true)) attributes.setEL("ismap","ismap");
286        attributes.setEL("ismap",ismap);
287    }
288    
289    public void setReadonly(String readonly) {
290        // alles ausser false ist true
291        //if(Caster.toBooleanValue(readonly,true)) attributes.setEL("readonly","readonly");
292        attributes.setEL("readonly",readonly);
293    }
294    
295    public void setUsemap(String usemap) {
296        attributes.setEL("usemap",usemap);
297    }
298
299    /**
300     * @param onBlur The onBlur to set.
301     */
302    public void setOnblur(String onBlur) {
303        attributes.setEL("onblur",onBlur);
304    }
305    /**
306     * @param onChange The onChange to set.
307     */
308    public void setOnchange(String onChange) {
309        attributes.setEL("onchange",onChange);
310    }
311    /**
312     * @param onClick The onClick to set.
313     */
314    public void setOnclick(String onClick) {
315        attributes.setEL("onclick",onClick);
316    }
317    /**
318     * @param onDblclick The onDblclick to set.
319     */
320    public void setOndblclick(String onDblclick) {
321        attributes.setEL("ondblclick",onDblclick);
322    }
323    /**
324     * @param onFocus The onFocus to set.
325     */
326    public void setOnfocus(String onFocus) {
327        attributes.setEL("onfocus",onFocus);
328    }
329    /**
330     * @param onKeyDown The onKeyDown to set.
331     */
332    public void setOnkeydown(String onKeyDown) {
333        attributes.setEL("onkeydown",onKeyDown);
334    }
335    /**
336     * @param onKeyPress The onKeyPress to set.
337     */
338    public void setOnkeypress(String onKeyPress) {
339        attributes.setEL("onkeypress",onKeyPress);
340    }
341    /**
342     * @param onKeyUp The onKeyUp to set.
343     */
344    public void setOnkeyup(String onKeyUp) {
345        attributes.setEL("onKeyUp",onKeyUp);
346    }
347    /**
348     * @param onMouseDown The onMouseDown to set.
349     */
350    public void setOnmousedown(String onMouseDown) {
351        attributes.setEL("onMouseDown",onMouseDown);
352    }
353    /**
354     * @param onMouseMove The onMouseMove to set.
355     */
356    public void setOnmousemove(String onMouseMove) {
357        attributes.setEL("onMouseMove",onMouseMove);
358    }
359    /**
360     * @param onMouseUp The onMouseUp to set.
361     */
362    public void setOnmouseup(String onMouseUp) {
363        attributes.setEL("onMouseUp",onMouseUp);
364    }
365    /**
366     * @param onMouseUp The onMouseUp to set.
367     */
368    public void setOnselect(String onselect) {
369        attributes.setEL("onselect",onselect);
370    }
371    /**
372     * @param onMouseOut The onMouseOut to set.
373     */
374    public void setOnmouseout(String onMouseOut) {
375        attributes.setEL("onMouseOut",onMouseOut);
376    }
377    /**
378     * @param onMouseOver The onKeyPress to set.
379     */
380    public void setOnmouseover(String onMouseOver) {
381        attributes.setEL("onMouseOver",onMouseOver);
382    }
383    /**
384     * @param tabIndex The tabIndex to set.
385     */
386    public void setTabindex(String tabIndex) {
387        attributes.setEL("tabindex",tabIndex);
388    }
389    /**
390     * @param title The title to set.
391     */
392    public void setTitle(String title) {
393        attributes.setEL("title",title);
394    }
395    /**
396     * @param value The value to set.
397     */
398    public void setValue(String value) {
399        attributes.setEL("value",value);
400    }
401    /**
402     * @param size The size to set.
403     */
404    public void setSize(String size) {
405        attributes.setEL("size",size);
406    }
407    /**
408     * @param maxLength The maxLength to set.
409     */
410    public void setMaxlength(double maxLength) {
411        input.setMaxLength((int)maxLength);
412        attributes.setEL("maxLength",Caster.toString(maxLength));
413    }
414    /**
415     * @param checked The checked to set.
416     */
417    public void setChecked(String checked) {
418        // alles ausser false ist true
419        if(Caster.toBooleanValue(checked,true)) attributes.setEL("checked","checked");
420    } 
421    /**
422     * @param daynames The daynames to set.
423     * @throws ApplicationException 
424     */
425    public void setDaynames(String listDaynames) throws ApplicationException {
426        String[] arr = ListUtil.listToStringArray(listDaynames, ',');
427        if(arr.length==7)
428                throw new ApplicationException("value of attribute [daynames] must contain a string list with 7 values, now there are "+arr.length+" values");
429        this.daynames=arr;
430    }
431    /**
432     * @param daynames The daynames to set.
433     * @throws ApplicationException 
434     */
435    public void setFirstdayofweek(double firstDayOfWeek) throws ApplicationException {
436        if(firstDayOfWeek<0 || firstDayOfWeek>6)
437                throw new ApplicationException("value of attribute [firstDayOfWeek] must conatin a numeric value between 0-6");
438        this.firstDayOfWeek=firstDayOfWeek;
439    }
440    /**
441     * @param daynames The daynames to set.
442     * @throws ApplicationException 
443     */
444    public void setMonthnames(String listMonthNames) throws ApplicationException {
445        String[] arr = ListUtil.listToStringArray(listMonthNames, ',');
446        if(arr.length==12)
447                throw new ApplicationException("value of attribute [MonthNames] must contain a string list with 12 values, now there are "+arr.length+" values");
448        this.monthnames=arr;
449    }
450    
451    /**
452     * @param daynames The daynames to set.
453     */
454    public void setLabel(String label) {
455        this.label=label;
456    }
457    /**
458     * @param daynames The daynames to set.
459     */
460    public void setMask(String mask) {
461        this.mask=mask;
462    }
463
464    public void setMax(String max) {
465                attributes.setEL("max",max);
466        }
467    public void setMin(String min) {
468                attributes.setEL("min",min);
469        }
470    public void setMultiple(String multiple) {
471                attributes.setEL("multiple",multiple);
472        }
473    public void setPlaceholder(String placeholder) {
474                attributes.setEL("placeholder",placeholder);
475        }
476    
477    
478    
479    /**
480     * @param daynames The daynames to set.
481     */
482    public void setNotab(String notab) {
483        attributes.setEL("notab",notab);
484    }
485    /**
486     * @param daynames The daynames to set.
487     */
488    public void setHspace(String hspace) {
489        attributes.setEL("hspace",hspace);
490    }
491    
492    /**
493     * @param type The type to set.
494     * @throws ApplicationException
495     */
496    public void setType(String type) throws ApplicationException {      
497        type=type.toLowerCase().trim();
498        if(             "checkbox".equals(type))        input.setType(TYPE_CHECKBOX);
499        else if("password".equals(type))        input.setType(TYPE_PASSWORD);
500        else if("text".equals(type))            input.setType(TYPE_TEXT);
501        else if("radio".equals(type))           input.setType(TYPE_RADIO);
502        else if("button".equals(type))          input.setType(TYPE_BUTTON);
503        else if("file".equals(type))            input.setType(TYPE_FILE);
504        else if("hidden".equals(type))          input.setType(TYPE_HIDDEN);
505        else if("image".equals(type))           input.setType(TYPE_IMAGE);
506        else if("reset".equals(type))           input.setType(TYPE_RESET);
507        else if("submit".equals(type))          input.setType(TYPE_SUBMIT);
508        else if("datefield".equals(type))       input.setType(TYPE_DATEFIELD);
509        
510        else throw new ApplicationException("attribute type has an invalid value ["+type+"]","valid values for attribute type are " +
511                        "[checkbox, password, text, radio, button, file, hidden, image, reset, submit, datefield]");
512
513        attributes.setEL("type",type);
514    }
515    
516    /**
517     * @param onError The onError to set.
518     */
519    public void setOnerror(String onError) {
520        input.setOnError(onError);
521    }
522    /**
523     * @param onValidate The onValidate to set.
524     */
525    public void setOnvalidate(String onValidate) {
526        input.setOnValidate(onValidate);
527    }
528    /**
529     * @param passthrough The passThrough to set.
530     * @throws PageException
531     */
532    public void setPassthrough(Object passthrough) throws PageException {
533        if(passthrough instanceof Struct) {
534            Struct sct = (Struct) passthrough;
535            Iterator<Entry<Key, Object>> it = sct.entryIterator();
536            Entry<Key, Object> e;
537            while(it.hasNext()) {
538                e=it.next();
539                attributes.setEL(e.getKey(),e.getValue());
540            }
541        }
542        else this.passthrough = Caster.toString(passthrough);
543        
544        //input.setPassThrough(passThrough);
545    }
546    /**
547     * @param pattern The pattern to set.
548     * @throws ExpressionException 
549     */
550    public void setPattern(String pattern) throws ExpressionException {
551        input.setPattern(pattern);
552    }
553    /**
554     * @param range The range to set.
555     * @throws PageException
556     */
557    public void setRange(String range) throws PageException {
558        String errMessage="attribute range has an invalid value ["+range+"], must be string list with numbers";
559        String errDetail="Example: [number_from,number_to], [number_from], [number_from,], [,number_to]";
560        
561        Array arr=ListUtil.listToArray(range,',');
562        
563        if(arr.size()==1) {
564            double from=Caster.toDoubleValue(arr.get(1,null),true,Double.NaN);
565            if(!Decision.isValid(from))throw new ApplicationException(errMessage,errDetail);
566            input.setRangeMin(from);
567            input.setRangeMax(Double.NaN);
568        }
569        else if(arr.size()==2) {
570            String strFrom=arr.get(1,"").toString().trim();
571            double from=Caster.toDoubleValue(strFrom,Double.NaN);
572            if(!Decision.isValid(from) && strFrom.length()>0) {
573                throw new ApplicationException(errMessage,errDetail);
574            }
575            input.setRangeMin(from);
576            
577            String strTo=arr.get(2,"").toString().trim();
578            double to=Caster.toDoubleValue(strTo,Double.NaN);
579            if(!Decision.isValid(to) && strTo.length()>0) {
580                throw new ApplicationException(errMessage,errDetail);
581            }
582            input.setRangeMax(to);
583            
584        }
585        else throw new ApplicationException(errMessage,errDetail);
586    }
587    /**
588     * @param required The required to set.
589     */
590    public void setRequired(boolean required) {
591        input.setRequired(required);
592    }
593    /**
594     * @param name The name to set.
595     */
596    public void setName(String name) {
597        attributes.setEL(KeyConstants._name,name);
598        input.setName(name);
599    }
600    /**
601     * @param message The message to set.
602     */
603    public void setMessage(String message) {
604        if(!StringUtil.isEmpty(message))input.setMessage(message);
605    }
606
607    @Override
608        public int doEndTag() throws PageException {
609                try {
610            _doEndTag();
611        }
612                catch (IOException e) {
613           throw Caster.toPageException(e);
614        }
615        return EVAL_PAGE;
616        }
617
618        private void _doEndTag() throws PageException, IOException {
619        // check attributes
620        if(input.getValidate()==VALIDATE_REGULAR_EXPRESSION && input.getPattern()==null) {
621            throw new ApplicationException("when validation type regular_expression is seleted, the pattern attribute is required");
622        }
623
624        Tag parent = getParent();
625        while(parent!=null && !(parent instanceof Form)){
626                        parent=parent.getParent();
627                }
628        if(parent instanceof Form) {
629                    Form form = (Form)parent;
630                    form.setInput(input);
631                    if(input.getType()==TYPE_DATEFIELD && form.getFormat()!=Form.FORMAT_FLASH)
632                        throw new ApplicationException("type [datefield] is only allowed if form format is flash");
633                }
634                else { 
635                    throw new ApplicationException("Tag must be inside a form tag");
636                }
637        draw();
638    }
639
640    void draw() throws IOException, PageException {
641
642        // start output
643        pageContext.forceWrite("<input");
644        
645        //lucee.runtime.type.Collection.Key[] keys = attributes.keys();
646        //lucee.runtime.type.Collection.Key key;
647        Iterator<Entry<Key, Object>> it = attributes.entryIterator();
648        Entry<Key, Object> e;
649        while(it.hasNext()) {
650            e = it.next();
651            pageContext.forceWrite(" ");
652            pageContext.forceWrite(e.getKey().getString());
653            pageContext.forceWrite("=\"");
654            pageContext.forceWrite(enc(Caster.toString(e.getValue())));
655            pageContext.forceWrite("\"");
656           
657        }
658        
659        if(passthrough!=null) {
660            pageContext.forceWrite(" ");
661            pageContext.forceWrite(passthrough);
662        }
663        pageContext.forceWrite(">");
664        }
665
666        /**
667     * html encode a string
668     * @param str string to encode
669     * @return encoded string
670     */
671    String enc(String str) {
672        return HTMLEntities.escapeHTML(str,HTMLEntities.HTMLV20);
673    }
674
675        /**
676         * @return the monthnames
677         */
678        public String[] getMonthnames() {
679                return monthnames;
680        }
681
682        /**
683         * @param monthnames the monthnames to set
684         */
685        public void setMonthnames(String[] monthnames) {
686                this.monthnames = monthnames;
687        }
688
689        /**
690         * @param height the height to set
691         */
692        public void setHeight(String height) {
693                attributes.setEL("height",height);
694        }
695
696        /**
697         * @param input the input to set
698         */
699        public void setInput(InputBean input) {
700                this.input = input;
701        }
702
703        /**
704         * @param passthrough the passthrough to set
705         */
706        public void setPassthrough(String passthrough) {
707                this.passthrough = passthrough;
708        }
709
710        /**
711         * @param tooltip the tooltip to set
712         * @throws ApplicationException 
713         */
714        public void setTooltip(String tooltip) {
715                this.tooltip = tooltip;
716        }
717
718        /**
719         * @param validateAt the validateAt to set
720         * @throws ApplicationException 
721         */
722        public void setValidateat(String validateAt) throws ApplicationException {
723                this.validateAt = validateAt;
724                throw new ApplicationException("attribute validateAt is not supportrd for tag input ");
725
726        }
727
728        /**
729         * @param visible the visible to set
730         * @throws ApplicationException 
731         */
732        public void setVisible(boolean visible) {
733                this.visible = visible;
734        }
735
736        /**
737         * @param width the width to set
738         * @throws ApplicationException 
739         */
740        public void setWidth(String width) {
741                attributes.setEL("width", width);
742        }
743        
744        
745    private ExpressionException notSupported(String label) {
746                return new ExpressionException("attribute ["+label+"] is not supported");
747        }
748    
749    
750
751
752    public void setAutosuggest(String autosuggest) throws ExpressionException {
753        throw notSupported("autosuggest");
754        //attributes.setEL("bind",bind);
755    }
756    public void setAutosuggestbinddelay(double autosuggestBindDelay) throws ExpressionException {
757        throw notSupported("autosuggestBindDelay");
758        //attributes.setEL("bind",bind);
759    }
760    public void setAutosuggestminlength(double autosuggestMinLength) throws ExpressionException {
761        throw notSupported("autosuggestMinLength");
762        //attributes.setEL("bind",bind);
763    }
764
765    public void setBind(String bind) throws ExpressionException {
766        throw notSupported("bind");
767        //attributes.setEL("bind",bind);
768    }
769    
770    public void setBindattribute(String bindAttribute) throws ExpressionException {
771        throw notSupported("bindAttribute");
772        //attributes.setEL("bind",bind);
773    }
774    
775    public void setBindonload(boolean bindOnLoad) throws ExpressionException {
776        throw notSupported("bindOnLoad");
777        //attributes.setEL("bind",bind);
778    }
779
780    public void setDelimiter(String delimiter) throws ExpressionException {
781        throw notSupported("delimiter");
782        //attributes.setEL("bind",bind);
783    }
784    public void setMaxresultsdisplayed(double maxResultsDisplayed) throws ExpressionException {
785        throw notSupported("maxResultsDisplayed");
786        //attributes.setEL("bind",bind);
787    }
788    public void setOnbinderror(String onBindError) throws ExpressionException {
789        throw notSupported("onBindError");
790        //attributes.setEL("bind",bind);
791    }
792    public void setShowautosuggestloadingicon(boolean showAutosuggestLoadingIcon) throws ExpressionException {
793        throw notSupported("showAutosuggestLoadingIcon");
794        //attributes.setEL("bind",bind);
795    }
796    public void setSourcefortooltip(String sourceForTooltip) throws ExpressionException {
797        throw notSupported("sourceForTooltip");
798        //attributes.setEL("bind",bind);
799    }
800    
801    public void setSrc(String src) {
802        attributes.setEL("src",src);
803    }
804    public void setStep(String step) {
805        attributes.setEL("step",step);
806    }
807    public void setTypeahead(boolean typeahead) throws ExpressionException {
808        throw notSupported("typeahead");
809        //attributes.setEL("src",src);
810    }
811    
812    
813    
814}