|
Post by knoware on Feb 27, 2008 13:29:37 GMT -5
Is it possible to have a textbox with a specific size. If I only want 3 characters to be input into a textbox, how do I present a textbox on the form so it only accepts 3 characters.
Thanks for the help...
|
|
|
Post by wurlde on Feb 27, 2008 16:24:26 GMT -5
I though I've seen it somewhere (in JS, but you can use JS with RB, so it depends if you want use JS in you app) <SCRIPT LANGUAGE="JavaScript"> // function parameters are: field - the string field, count - the field for remaining characters number // and max - the maximum number of characters function CountLeft(field, count, max) { // if the length of the string in the input field is greater than the max value, trim it if (field.value.length > max) field.value = field.value.substring(0, max); else // calculate the remaining characters count.value = max - field.value.length; } </script>
<center> <form name=sample action=""> <font size="1" face="arial, helvetica, sans-serif"> Only 50 characters allowed! // at every key up and key down event the upper function is called <input name="text" type="text" size="40" onKeyDown="CountLeft(this.form.text,this.form.left,50);" onKeyUp="CountLeft(this.form.text,this.form.left,50);"> <input readonly type="text" name="left" size=3 maxlength=3 value="50"> characters left</font> </form> </center>
if not, you can always check the length afterwards an if greater than your desired size, show an error and return to your original block hope it helps (code taken from www.solotuweb.com/fs~id~1903.html)
|
|
|
Post by knoware on Feb 28, 2008 1:40:40 GMT -5
I guess I was hopeful that there would be a way to use the TEXTBOX similar to the HTML input statement: <INPUT TYPE='TEXT' id='Type' SIZE='1' maxsize='3' VALUE='X'>
This simply displays a input area for 1 character, however it lets the user input a maximum of 3 characters by scrolling the values to the right as you enter.
Maybe there is a way to use the TEXTBOX in combination with CSS.
|
|
|
Post by mikeukmid on Feb 28, 2008 10:09:01 GMT -5
|
|
|
Post by wurlde on Feb 28, 2008 10:10:07 GMT -5
sorry, but both, my JS and my CSS are very basic :S if you reach your objective, please, tell me how
|
|
|
Post by knoware on Feb 28, 2008 14:28:49 GMT -5
I tried a few things, but I always get the same error. I'm trying to make the textbox smaller. I don't have room for the larger box. This is holding up a project, so I hope someone has the answer. Being a first time user, I may be doing something wrong here. I have a link and a textbox in the example. The link accepts the cssclass, but the textbox errors on everything I've tried. Any Suggestions? CALL SetCSS link #a, "Nothing",[nothing] #a cssclass("width")
TEXTBOX #a1, numRows #a1 cssclass("width")
wait SUB SetCSS CSSClass "a.width", "{ Width: 60px; Height: 17px; }" END SUB Runtime Error in program 'album': #a1 cssclass("width") Unrecognized command for #a1: CSSCLASS()
|
|
|
Post by mikeukmid on Feb 28, 2008 15:41:55 GMT -5
CSSClass "a", "{ font-size:14pt }"
link #a, "Nothing",[nothing]
CSSClass "input.text", "{ Width: 60px; Height: 17px; margin-left:10px }"
TEXTBOX #a1, numRows wait
Does this help?
Mike
|
|
|
Post by knoware on Feb 28, 2008 17:12:26 GMT -5
Thanks.. That works better.
However I have about 30 textboxes and need them to be various sizes.
The css for input.text sets the width for the whole page. Basically the last CSSClass executed sets them all. In the example they are all set to 60px. Maybe there is a way to set each in a <DIV> and set the <DIV>.
CSSClass "input.text", "{Width: 20px;}" TEXTBOX #a2, numRows ' want this 20px wide
CSSClass "input.text", "{Width: 40px;}" TEXTBOX #a3, numRows ' want this 40px wide
CSSClass "input.text", "{Width: 60px;}" TEXTBOX #a4, numRows ' want this 60 px wide wait
|
|
|
Post by mackrackit on Feb 29, 2008 2:05:16 GMT -5
I was playing with this and noticed that when I use CSSClass "input.text", "{ Width: 60px; Height: 17px; margin-left:10px }"
Then go to save the project, the text box there is the same width stated in the class. Save the project, start a new one and the text box on the save page is still 60px. Reopen my text box project and change the width to 100, save the project. Start a new project, go to the save page and now the text box is 100px.
|
|
|
Post by mikeukmid on Feb 29, 2008 5:06:51 GMT -5
Dave, There is a note in the CSS tutorial which emphasises the fact that code with css may change the IDE appearance. CSS applied to input.txt, input.submit, textarea and other widgets, when run in the IDE will modify the RB IDE.
|
|
|
Post by mackrackit on Feb 29, 2008 5:24:13 GMT -5
Well...I will blame my new Bifocals. I did not see that note. Thanks
|
|
|
Post by knoware on Feb 29, 2008 6:57:33 GMT -5
I guess I'm about to give up. I've tried about everything. I thought <DIV> would work but this example ends up with both textarea sizes the same. CSSID #px10, "{Width: 10px;}" DIV px10 TEXTBOX #p10 ,"aaa" END DIV TEXTBOX #pstandard ,"aaa" END
Unfortunately this is a show stopper for me. Maybe this will be fixed in the future, and we can try using RunBasic again.. Thanks for all the help.
|
|
|
Post by mikeukmid on Feb 29, 2008 8:07:09 GMT -5
RB is only at V1. Could you not ask Carl if he is able to introduce cssclass() for textboxes in time for the next release?
|
|
|
Post by carlgundel on Feb 29, 2008 8:55:43 GMT -5
RB is only at V1. Could you not ask Carl if he is able to introduce cssclass() for textboxes in time for the next release? I've been watching this from the sidelines because I was hoping someone would come up with a clever way to solve this problem. So, it looks like a good thing to fix in the beta. I will try to have the beta out this weekend. -Carl
|
|
|
Post by knoware on Feb 29, 2008 9:28:05 GMT -5
If there was a way, I think I'd have stumbled on it, cause I tried a bunch of stuff.
I can probably live with the textarea also, but again I need to alter the size of the box.
Actually I can live these, if I knew there would be a way to handle this sometime in the future.
If it's in the beta that would even be better...
Thanks everyone for your help...
|
|