Skip to content
This repository has been archived by the owner on Dec 12, 2018. It is now read-only.

RecordSelect not working upon validation errors #3

Open
satynos opened this issue Jan 29, 2010 · 5 comments
Open

RecordSelect not working upon validation errors #3

satynos opened this issue Jan 29, 2010 · 5 comments

Comments

@satynos
Copy link

satynos commented Jan 29, 2010

My app uses ActiveScaffold and RecordSelect.

RecordSelect is working fine and showing the associated objects in auto-complete field while creating a new record or editing existing record. But when there is a validation error, it stops working. I reviewed the code that gets sent to the browser when there is a validation error. It has JavaScript for new RecordSelect.Single('id) but is not being executed. If I enter the same JavaScript code in the firebug console, then it is popping up the auto-complete results.

Any help is much appreciated.

-Satynos

@cainlevy
Copy link
Owner

Sounds like ActiveScaffold is rewriting the form, but RecordSelect is not re-initializing.

@satynos
Copy link
Author

satynos commented Jan 29, 2010

I didn't quite understand what you mean by not re-initializing. I see JavaScript code new RecordSelect.Single('some_id') in the output that is sent by the server. For some reason it's not executed by the browser. I even added console.log('test') before new RecordSelect.Single('some_id) and after, both console.log calls are executed and I can see the output in the firebug console. But the new RecordSelect.Single('some_id') is not executed.

Any feedback on how to get this to work is appreciated.
Thanks in advance.
-Satynos

@cainlevy
Copy link
Owner

Hmm. Can you determine whether the JS is being executed before or after the HTML is rewritten? It needs to be executed afterwards so that it binds to the correct elements.

You could also try adding a console.log('...') command inside the RecordSelect code to determine whether it's running at all.

@satynos
Copy link
Author

satynos commented Jan 29, 2010

Whats the best way to determine at what point JS is being executed?

Also I did add console.log('testing from RecordSelect.initialize') in RecordSelect Initialize method, and that part is being executed.

@satynos
Copy link
Author

satynos commented Jan 29, 2010

Also if it helps, following is the link to the content that is sent by the browser upon validation error:

http://www.pastie.org/private/dxtyrx46whjae5vqgm5ha

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants