Question

I really tried to search so I apologise beforehand if this has already and I just wasn't able to find it.

I am trying to use crossrider to create a form inside a popup and evaluate the response by clicking on a button, then returning a value to the user. I was able to do this manually through writing the code on TextWrangler for chrome but I haven't been able to make it execute when I do it through crossrider. On my attempts through cross rider I'm able to create the popup with the form inside it but the button doesn't do anything when pressing it.

My guess is that I have to use the API in order for this to work, but my javascript knowledge is very small (I am learning specifically for this project) so the documentation is quite hard to follow on regards to where I should put each thing and how to call it.

You can find my extension here, if I should mention anything else please do tell me.

Was it helpful?

Solution

The issue relates to how you are adding your popup.js file from resources. Currently, you are using a standard HTML SCRIPT tag that has no access to resources <script type="text/javascript" src="popup.js"></script>. However, to access extension resources you must use the Crossrider API, and hence replace your script tag as follows:

<script type="text/javascript">function crossriderMain($) {
    // get popup.js from resource and then eval to include in popup scope
    eval(appAPI.resources.get('popup.js'));
}</script>

I recommend that you take the time to become familiar with the Crossrider framework by visiting the Developer Center, reviewing the Demos, reading the Documentation, Guides, and FAQs and thus gain an overall understanding of what you can accomplish with the framework.

[Disclosure: I am a Crossrider employee]

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top