2fas2c
Posts: 0
Joined: Mon Dec 16, 2013 11:43 pm

How do I know if a select box has completed loading?

I have a form with a selectbox (athlete name) and a text box (score). On the edit score page, i have two services:
loadAthleteService - which loads the list of all athletes
loadScoreService - which loads a score for a particular athlete.

On Form load: (invoke javascript) -
loadAthleteService.execute( {
success:function(e) {
loadScoreService.execute();
}
}

I get an error: "Error: cannot call methods on selectmenu prior to initialization; attempted to call method 'refresh'"

I know what the error means but why is trying to execute loadscoreservice even before the athlete select box is populated in spite of it being in the success event.

Thanks

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

How do I know if a select box has completed loading?

Hello,

Just to clearify..do you mean Select or Checkbox?
How exactly do you add component with athlete name?
It might happen as when you add components you need to call refresh.

2fas2c
Posts: 0
Joined: Mon Dec 16, 2013 11:43 pm

How do I know if a select box has completed loading?

It is a Select box (Dropdown). No they are not components.

2fas2c
Posts: 0
Joined: Mon Dec 16, 2013 11:43 pm

How do I know if a select box has completed loading?

This does not work. I am sure I am doing something wrong or my understanding is incorrect.

As I said above, I do this:
loadAthleteService.execute( {
success:function(e) {
loadScoreService.execute();
}
}

and I don't see the response mapping of loadScoreService executed. None of the field mappings have the right values.

I went an added the following:
On Complete for loadScoreService, i added a javascript
alert(jqXHR.responseText);

On field mapping of loadScoreService, on one of the field, I add javascript by going through "Edit JS" and added
alert(value);

When I run it, i get the alert (value) as undefined and then the responseText.

Is this the correct order? Shouldn't i see the responseText alert first and then the value alert?

Thanks

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

How do I know if a select box has completed loading?

Please show us mapping screen shot. Also check browser console that there are no errors http://docs.appery.io/documentation/d....

2fas2c
Posts: 0
Joined: Mon Dec 16, 2013 11:43 pm

How do I know if a select box has completed loading?

Also, on complete event of readAthleteService, I have the following javascript to populate the dropdown with the list of valid athlete names

Image

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

How do I know if a select box has completed loading?

Make sure you bind correct (see the section Select) http://docs.appery.io/documentation/r...

2fas2c
Posts: 0
Joined: Mon Dec 16, 2013 11:43 pm

How do I know if a select box has completed loading?

i will. It does not answer my question on the order in which the mapping and the complete action are being executed. I also have a few text fields whose value are not getting populated.

Return to “Issues”