Sigma Php Ajax framework, Ajax Components, GUI Builder
May 24, 2012, 10:48:57 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
Sigma Php Ajax framework, Ajax Components, GUI Builder
>
Sigma Visual GUI Builder & Library
>
Sigma Visual - Q&A
(Moderators:
steven
,
linb
) >
maxlength in input/textbox
Pages: [
1
]
« previous
next »
Print
Author
Topic: maxlength in input/textbox (Read 703 times)
jovibals
Hero Member
Posts: 133
maxlength in input/textbox
«
on:
April 27, 2010, 11:58:31 PM »
hi linb,
Textbox in a normal html i can set the maxlength and once you copy a words from the notepad then paste it only allows whatever the number you have set in the textbox. But using input in visualjs and set the length using "valueFormat" then typing inside of it validate the length of the input and you cannot type continuosly but once i copy from notepad then paste inside of it. It accept and no error occurs.
Can you help me how will i do this? you cannot paste more than characters.
Thank you
Logged
linb
Administrator
Hero Member
Posts: 435
Re: maxlength in input/textbox
«
Reply #1 on:
April 30, 2010, 05:45:24 PM »
input1 is for all input and textarea in some browser.
input2 is for all input and textarea .
Class('App', 'linb.Com',{ Instance:{ autoDestroy:true, iniComponents:function(){ // [[code created by jsLinb UI Builder var host=this, children=[], append=function(child){children.push(child.get(0))}; append((new linb.UI.Input) .host(host,"input1") .setLeft(50) .setTop(20) .onRender("_input2_onrender") ); append((new linb.UI.Input) .host(host,"input2") .setLeft(50) .setTop(60) .setDynCheck(true) .onChange("_input2_onchange") .beforeKeypress("_input2_beforekeypress") ); return children; // ]]code created by jsLinb UI Builder }, _input2_onrender:function (profile) { profile.getSubNode('INPUT').attr('maxlength', 10); }, _input2_beforekeypress:function (profile, caret, key, ctrl, shift, alt, e, src) { if(key.length==1){ if(ctrl && (key=='c'||key=='x'||key=='a')) return true; var len=profile.boxing().getUIValue().length - (caret[1]-caret[0]); if (len >= 10) return false; } }, _input2_onchange:function (profile, oldValue, newValue) { if (newValue.length > 10) profile.boxing().setUIValue(newValue.substr(0,10),true); } } });
Logged
linb
Administrator
Hero Member
Posts: 435
Re: maxlength in input/textbox
«
Reply #2 on:
April 30, 2010, 06:02:53 PM »
And, I added getMaxlength/setMaxlength fuction. You can use "input.setMaxlength(10)" to do this.
Check it out from svn please!
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> News & Announcements
-----------------------------
Sigma Visual GUI Builder & Library
-----------------------------
=> Sigma Visual - Knowledge Share
=> Sigma Visual - Q&A
=> Bug Report & Wishlist
-----------------------------
Sigma Grid
-----------------------------
=> Sigma Grid - Q&A
=> Show Case
=> Bug Report & Wishlist
-----------------------------
Other
-----------------------------
=> AJAX & JavaScript
Loading...