Page 1 of 2

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

Posted: Sat Mar 08, 2014 6:50 pm
by 2fas2c

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


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

Posted: Sat Mar 08, 2014 7:32 pm
by Alena Prykhodko

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.


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

Posted: Sun Mar 09, 2014 3:15 pm
by 2fas2c

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


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

Posted: Sun Mar 09, 2014 5:28 pm
by Igor

Hello,

Let us know if this helps http://stackoverflow.com/questions/17...


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

Posted: Sun Mar 23, 2014 3:21 am
by 2fas2c

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


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

Posted: Sun Mar 23, 2014 3:30 am
by Alena Prykhodko

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


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

Posted: Sun Mar 23, 2014 3:36 am
by 2fas2c

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

Posted: Sun Mar 23, 2014 3:57 am
by 2fas2c

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

Image


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

Posted: Sun Mar 23, 2014 4:00 am
by Alena Prykhodko

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


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

Posted: Sun Mar 23, 2014 2:19 pm
by 2fas2c

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.