Kirix Support Forums

textbox length

Please post any help questions, requests or other feedback here.

textbox length

Postby abenitez77 on Fri Feb 25, 2011 1:09 pm

How do i get the length of a textbox?

I tried this below with a textbox called mytextbox but it didn't work.
mytextbox.length
abenitez77
Registered User
 
Posts: 143
Joined: Fri Jan 21, 2011 12:42 pm

Re: textbox length

Postby abenitez77 on Fri Feb 25, 2011 1:10 pm

abenitez77 wrote:How do i get the length of a textbox?

I tried this below with a textbox called mytextbox but it didn't work.
mytextbox.length


I want to know if I have a string greater than 10 in the text box. It is a multiline textbox. thanks.
abenitez77
Registered User
 
Posts: 143
Joined: Fri Jan 21, 2011 12:42 pm

Re: textbox length

Postby abenitez77 on Fri Feb 25, 2011 3:27 pm

Ok, I found how to get the length..but now I need to execute the text that is in a text box (TSQL code). It is a multiline textbox.

textbox2.selectAll();
var MyLen = textbox2.getSelectedText().length;
if (MyLen > 10)
{
SQLTbl = db3.execute(textbox2.getSelectedText());
}
else
{
SQLTbl = db3.execute("Select * From [" + selected_items[x] + "]");
}
abenitez77
Registered User
 
Posts: 143
Joined: Fri Jan 21, 2011 12:42 pm

Re: textbox length

Postby Ben on Fri Feb 25, 2011 5:35 pm

Hi there,

Your code looks like it should work. I'd use getText() instead of getSelectedText(), otherwise all the text in your control needs to be selected first.
Ben Williams
Kirix Support Team
User avatar
Ben
Kirix Support Team
 
Posts: 525
Joined: Mon Dec 19, 2005 6:29 am

Re: textbox length

Postby abenitez77 on Mon Feb 28, 2011 12:18 pm

It returns the length but I cannot excute the text this way...it does not return records. I did an elert to see what was in textbox2 and it had the correct sql statement. Do I have reference the variable instead of the way i am doing it below?

This does not work:
SQLTbl = db3.execute(textbox2.getText());

When i do this, it works fine:
SQLTbl = db3.execute("Select * From [" + selected_items[x] + "]");
abenitez77
Registered User
 
Posts: 143
Joined: Fri Jan 21, 2011 12:42 pm

Re: textbox length

Postby abenitez77 on Mon Feb 28, 2011 1:02 pm

abenitez77 wrote:It returns the length but I cannot excute the text this way...it does not return records. I did an elert to see what was in textbox2 and it had the correct sql statement. Do I have reference the variable instead of the way i am doing it below?

This does not work:
SQLTbl = db3.execute(textbox2.getText());

When i do this, it works fine:
SQLTbl = db3.execute("Select * From [" + selected_items[x] + "]");


I put a test to see the results of the recordset and it does not contain records:
if (MyLen > 10)
{
var sqltxt = textbox2.getText();
alert("textbox2 > 10: " + sqltxt);
SQLTbl = db3.execute(sqltxt);
if (SQLTbl.hasNext())
{
alert("hasNext recs: " + textbox2.getText());
}
}
abenitez77
Registered User
 
Posts: 143
Joined: Fri Jan 21, 2011 12:42 pm

Re: textbox length

Postby abenitez77 on Tue Mar 01, 2011 5:07 pm

Any ideas? I can't figure this one out....
abenitez77
Registered User
 
Posts: 143
Joined: Fri Jan 21, 2011 12:42 pm

Re: textbox length

Postby abenitez77 on Wed Mar 02, 2011 9:10 pm

The code below does not work. It does not error out but does not execute anything. I did an alert() to check the content of textbox2 and it has the correct syntax. Do you see any problem with this?

textbox2.appendText("Select * \n Into dbo.[" + textbox3.getText()+ String.toString(x) + "] \n From [" + selected_items[x] + "]");

SQLTbl = db3.execute(textbox2.getText());
abenitez77
Registered User
 
Posts: 143
Joined: Fri Jan 21, 2011 12:42 pm

Return to Strata Help & Feedback