Sie sind nicht angemeldet.

1

Montag, 7. November 2011, 08:52

Need help with Javascript plugin creation

Hi all. My question is simply this: Can I make an IOS-compatible plugin that includes an input form where users can enter text and then submit it onwards? Help is much appreciated :) I'm managing to write a plugin which displays something on the canvas but haven't had success with input forms.

Is this possible to implement?

Thanks.

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

2

Montag, 7. November 2011, 09:44

should work yes. IOS uses javascript and HTML5. You could even use ajax(jquery) to post the form and get direct feedback. I haven't tested it, but I dont see any limitations atm.

3

Montag, 7. November 2011, 09:52

Thanks. But how to display an input form on the plugin canvas? code?

Thanks again.

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

4

Montag, 7. November 2011, 10:21

You could create a form outside of krpano in the html, set display to none with css. Then in the javascript plugin you could do something like:

var the_form = document.getElementById("yourformid");
plugin.sprite.appendChild(the_form);

Thats the easiest way. The other way would be creating the whole form in javascript...

var the_form = document.createElement('form');
the_form.id = "the_form";
the_form.action = "post.php";
var the_input = document.createElement('input');
the_form.appendChild(the_input);

not 100% sure about the syntax, but something like that.

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Zephyr« (7. November 2011, 11:40)


5

Montag, 7. November 2011, 10:24

Hi,

you don't need to use a canvas element, you can add any HTML elements to the "plugin.sprite" element,

the canvas element here in the example is just an example:
http://krpano.com/docu/plugininterface/#js

best regards,
Klaus

6

Montag, 7. November 2011, 10:55

OK. You may call me stupid but how am I adding stuff to plugin.sprite .......little hint please? :) First time trying to make something for the iDevices...been working with Flash for too long :)

7

Montag, 7. November 2011, 11:09

Hi,

with will be done with normal HTML/Javascript code (appendChild in this case),

see here the example javascript plugin source:
http://krpano.com/docu/plugininterface/#js

e.g.

Quellcode

1
2
3
var htmlelement = document.createElement("div");
...
plugin.sprite.appendChild(htmlelement );


best regards,
Klaus

8

Montag, 7. November 2011, 14:14

weird behaviour

So I finally managed to add a form to the js-plugin but but...in pc-browser (in iPad mode) the form works except I can't input any text to a textfield? And with a real iPhone I can enter text to it but can't make a checkbox selection nor click submit (which I can do on desktop)...

Are these bugs or what?