Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Water on Dec 18, 2007 04:56
open dhtmlx forum
Maxlength for the content of combobox

Hi,

I used the combobox for the data entry of my web program and it used for the data to input into database.
My database have set the size limit, so I also need the max length for the inputbox.
When I used the combobox, I find that it cannot set the max length for it that is difference to simple html textbox.

Are there any solution to set the max length for the combobox? Thank you.

Regards,
Water
Answer posted by Support on Dec 18, 2007 05:19
You can use onChange event to control the data in combo

combo.attachEvent("onChange",function(){
    var value=combo.getCoimboText();
    if (value.length > MAX_LIMIT ){
          //show warning or truncate value in combo here
    }
});
Answer posted on Dec 18, 2007 09:29
In html, I just need to set the maxlength and it will auto control user can't to input.
How can I block user to input by your method??

Are there any method to block the key event input by users?
Can it also control the copy and plast?
Answer posted by Support on Dec 19, 2007 01:36
You can use onKeyPressed event ( the same syntax as in above sample ) - event occurs after any key pressed inside combo ( it will not work for copy|paste operation initiated by mouse )