On Sep 7, 8:44 pm, Ngassa Carine <[email protected]>
wrote:
> Hello everyone,
>
> I'll start by describing what I'm doing and saying that I am a newbie.
> In my ROR (2.1.2) application, would like to send read data from a text
> field using the onclick tag to a python script I wrote.
> The problem I encounter is with the onclick tag. I used the system()
> function to call the python script, but it doesn't function. The python
> script is only called when I reload the page and not when I click on the
> send button.
> Who can help me or tell me how to better call the python script once I
> click on the send button.
> I'll be grateful for your help.
>
> This is what my code looks like:
>
> <form id="frmmain" name="frmmain" method="post">
> <input type="text" id="txt_message" name="txt_message" style="width:
> 400px;" />
> <input type="button" name="btn_send" id="btn_send" value="Send"
> onclick="<% system(@path + 'myfile.py ' + @partner + ' txt_message.value
> &') %>" />
> </form>
> --
I think you have a basic misunderstanding of how erb templates work.
Anything in <% or <%= tags is evaluated when the template is rendered
- that is what rendering an erb template means. Furthermore, an
onclick options can only be a chunk of javascript.
As Matt says, you need to write a controller action that your form is
submitted to. Furthermore, be careful of the data you receive - if the
example you posted worked it would allow a user to run arbitrary shell
commands on your server.
Fred
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---