enketo / enketo-dristhi

Customized enketo-core to be used in hybrid Android app called Dristhi
Apache License 2.0
2 stars 10 forks source link

Using document.write(androidContext.getForm()) in template.html #36

Open kirang20 opened 10 years ago

kirang20 commented 10 years ago

Hi Martijn,

We tried inlining document.write(androidContext.getForm()); in template.html (as before) but we cannot get forms to work correctly after that.

Some issues we are facing:

Any suggestions (if you need, we can send you an APK with these changes)?

MartijnR commented 10 years ago

Thanks @kirang20

yes, we probably need to un-requirjsify androidContext.mock.js, add it as a script to template.html (and then only set this global variable if it doesn't exist)

since it worked previously, we should be able to detect when the inline html has been added to the DOM, and wait for that before instantiating the new Form() in main.js.

I can have a look as well, but it will be next week probably.

kirang20 commented 10 years ago

I can wait till next week :). Sorry, Dristhi Training/Research is starting in March and we there are lot of things to complete by then. So thanks for the help.

MartijnR commented 10 years ago

Ah, well, I'll try to look at it sooner! Otherwise, we can leave it as-is for the training/research, right?

fwiw, what I'm working on this week, may very well be more significant in terms of performance.... :). Let's temper expectations though. Also, the new enketo-core includes a lot of css changes, so merging is going to take time too.

MartijnR commented 10 years ago

EC_Registration is the slowest form in Dristhi right?

kirang20 commented 10 years ago

Yes, it is okay for the research/training to start without this change (this is a nice to have feature not a must have). Not sure which is the slowest but some of the slow forms are:

MartijnR commented 10 years ago

@kiran20 I think I may have nailed bringing back the inline script now... It was indeed pretty hard...

I had to disable ziggy in the web view. This should happen automatically. If you have trouble using this in Drishti, these lines may not work: https://github.com/MartijnR/enketo-dristhi/blob/inline_form_injection/src/js/FormDataController.js#L3-L6

If it works, I'm curious if this speeds up loading.

I kept this in a separate branch (inline_form_injection)

cc @dpapathanasiou @prabhasp

MartijnR commented 10 years ago

@kirang20 just checking if you've seen this. Once you confirm it works, I'll merge it into master

kirang20 commented 10 years ago

As I said in another comment, we did merge this. Forms are working but I did not get time to check the performance, I will get back to you soon about performance.

On Wednesday, March 19, 2014, Martijn van de Rijdt notifications@github.com wrote:

@kirang20 https://github.com/kirang20 just checking if you've seen this. Once you confirm it works, I'll merge it into master

Reply to this email directly or view it on GitHubhttps://github.com/MartijnR/enketo-dristhi/issues/36#issuecomment-38060460 .

Regards, Kiran Nagu naguta nali nali ene agali

MartijnR commented 10 years ago

Cool! I'll merge the branch. Thx

kirang20 commented 10 years ago

Extremely sorry Martijn, I did not realise that this change was in a different branch (this is what juggling two or three tasks at the same time does!). So this was never merged onto Dristhi app, as we only updated from the master branch.

We did merge it today. We are finding that the forms are much slower now (EC registration form is taking close to 8 seconds more to load)! Not sure if it is due to this change alone. Thoughts?

MartijnR commented 10 years ago

No worries. It forced me to learn how to reverse a merge. Interesting it was slower! So either inline is slower after all, or I made some mistake.

If the forms seemed otherwise fully functional, I think inline injection may be slower after all.