Request focus help

Questions, tips and tricks and techniques for scripting in Servoy

Request focus help

Postby drookwood » Wed Feb 04, 2004 2:02 pm

I have a method that executes when the company_text field is changed. I need to confirm that company name has been entered before company_text (a checkbox) is changed from empty to filled. All of the method works as expected except that the requestFocus just doesn't happen!

If I run the requestFocus on its own it works fine, but at the the end of this method - nothing!

controller.saveData();
if ( company_text == 'company' && company_name ==''||company_text == 'company' && company_name == null)
{
plugins.dialogs.showErrorDialog( "Missing data", "Please enter company name first!", 'OK');
company_text = null;
forms.contacts_card.elements.company_name.requestFocus();
}

does anyone know why the requestFocus is not working?
drookwood
 
Posts: 290
Joined: Tue Nov 11, 2003 7:08 pm
Location: Somerset, UK

Postby jcompagner » Wed Feb 04, 2004 11:07 pm

to test: if you remove the controller.saveData call does it work then?

If still not, then can you give me a small example?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8841
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby IT2Be » Thu Feb 05, 2004 1:34 am

Hai Drookwood, I noticed that you do the requestfocus with a form name attached. Does that mean this method is outside this form (on another form)?

BTW why don't you do:

Code: Select all
if (company_text == 'company' && !company_name)


Ciao
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby drookwood » Tue Feb 10, 2004 12:07 am

jcompagner wrote:to test: if you remove the controller.saveData call does it work then?

I have tried this now:

if(company_text == 'company' && !company_name)
{
plugins.dialogs.showErrorDialog("Missing data"", "Please enter company name first!", "OK");
company_text = '';
elements.company_name.requestFocus();

Result is the same as before: everything else works but focus is not gained on the company_name field

If still not, then can you give me a small example?

I'll see if can set up a small test file and send it!
drookwood
 
Posts: 290
Joined: Tue Nov 11, 2003 7:08 pm
Location: Somerset, UK

Postby drookwood » Tue Feb 10, 2004 12:09 am

IT2BE wrote:Hai Drookwood, I noticed that you do the requestfocus with a form name attached. Does that mean this method is outside this form (on another form)?

No, the method is on the form, but removing the formname also makes no difference!

BTW why don't you do:

Code: Select all
if (company_text == 'company' && !company_name)

Thanks - much more elegant!
drookwood
 
Posts: 290
Joined: Tue Nov 11, 2003 7:08 pm
Location: Somerset, UK

Postby IT2Be » Tue Feb 10, 2004 9:13 am

Thanks for the compliment but it doesn't help solving the thing unfortunately :?

I don't have any answers/questions anymore... A bug?
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby r.rios » Sat Mar 27, 2004 1:12 am

I'm having a similar situation. All I want to do is create a new record and have a field get the focus.

Code: Select all
controller.newRecord();
elements.field.requestFocus();


If I only use the requestFocus it works fine. I'm running RC9 under MacOS 10.3.3.

Am I doing something wrong?


Ronnie
r.rios
 
Posts: 58
Joined: Mon Dec 01, 2003 3:59 am

Postby jcompagner » Sat Mar 27, 2004 12:46 pm

what view are you in?
List/Table or record?

for list/table you have to have RC10..
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8841
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby r.rios » Sat Mar 27, 2004 3:22 pm

There you have it, it's a list view. Is RC10 available? because Servoy can't find any updates.

Thanks,

Ronnie
r.rios
 
Posts: 58
Joined: Mon Dec 01, 2003 3:59 am

Postby jcompagner » Sun Mar 28, 2004 3:49 am

not yet.. will be there very soon
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8841
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Methods

Who is online

Users browsing this forum: No registered users and 3 guests