Submit a form automaticaly

4 views
Skip to first unread message

tonym...@gmail.com

unread,
Feb 28, 2014, 6:16:04 PM2/28/14
to node-...@googlegroups.com
Hi,

I am looking into node-webkit at the moment.

I have a form from a server. The form is a simple text input field and a button. I want to be able to display this form in a node-webkit sub-frame, and then -- when contents actually arrives -- I want to submit a pre-defined string in the form.

To do this, I need to:

* Find the form
* Find the first input field
* Find the first button

Then I can either:

* Submit the form automatically by submitting whatever came from the button
* OR paste the text in the first input field in the form, and artificially click the first button in the form.

Would something like this be possible? Sorry to bother you -- it's just that this is the _only_ purpose for me to learn node-webkit, and it would be tragic to discover that I cannot do what I want to after much work :D

This is _not_ for spamming purposes by the way.

Thank you!

Merc.

Laszlo Z. Antal

unread,
Mar 1, 2014, 12:27:18 PM3/1/14
to node-...@googlegroups.com, node-...@googlegroups.com
Hi
Absolutely possible. Think of node-webkit as a chrome browser on steroids and a trusty sidekick called node.js. So you can just load your form in an iframe then use plain JavaScript to do the rest the same way you would in any browser. Checkout the wiki page for frames because nw allows you to inject js and other stuff. 

Hope it helps

Laszlo
http://twitter.com/LZAntal

--
You received this message because you are subscribed to the Google Groups "node-webkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-webkit...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ervin Kosch

unread,
Mar 1, 2014, 5:40:23 PM3/1/14
to node-...@googlegroups.com
This is just a thought, but what if wrote the data to a varible instead? If its posting in the same domain you could use AJAX to simulate a form POST. That way you don't have to play when an extra form or window/frame. I have my own AJAX function I've written or you can use from jQuery or Zepto.

tonym...@gmail.com

unread,
Mar 2, 2014, 12:20:43 AM3/2/14
to node-...@googlegroups.com
Hi,

Thank you for your fantastic replies!

Merc.
Reply all
Reply to author
Forward
0 new messages