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
Kirix Support Forums
textbox length
8 posts
• Page 1 of 1
Re: textbox length
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
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] + "]");
}
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
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.
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
Kirix Support Team
-
Ben - Kirix Support Team
- Posts: 525
- Joined: Mon Dec 19, 2005 6:29 am
Re: textbox length
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] + "]");
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
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
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
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());
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
8 posts
· Page 1 of 1
Return to Strata Help & Feedback