Hello, i'm writing a form which i have to process in javascript (ajax). The
problem is i probably read too many manuals online and offline so i have a
bit of confusion in mind i should sort out some way. The thing is that my
form is generated by a json file (i'm using Tornado, so i'm reading the
json file in python and passing it to the web page when rendered to build
the form).

Now the form has to be processed by an ajax function and this is where it
gets tricky for me. i'm pasting the code written for now, there are two
type of ajax call written and i haven't tried to see if it work cause i'm
not undestanding what to do, so i've only tried to fill the variables
written in the examples online tring to undestand how it works.

The code is here below:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel='stylesheet' type='text/css' href='/static/style.css'/>
var lin={% raw line %}
function str_to_obj(o){
            document.write('<body><div id="up-bar"></div><div
id="logo"><img class="logo" src="/static/logo-admantx.png"
alt="logo"></div><form id="myform" action="/myform/" method="post">')
            document.write('<div id="myFormContainer">')
            for(item in o.Form) {
                    document.write(o.Form[item].Description + '
                    for(i in o.Form[item].Response){
                            document.write('<label for="' +
o.Form[item].Response[i].Name + '">');
                            document.write('<input type="radio"
name="message' + item +'" value="' + o.Form[item].Response[i].Name + '">' +
o.Form[item].Response[i].Name + '</label><br>');
            document.write('<input type="submit"
<script type="text/javascript" src="/static/prototype.js"></script>
                      # First example
Event.observe('myform', 'submit', function(event) {
        onFailure: function() {  },    #what should i write here?
        onSuccess: function(t) {
            $('myAdmantContainer').update(t.responseText);    #where should
i set responseText?
    Event.stop(event); // stop the form from submitting
                                        #second example
function chiam-ajax() {
    var url = '/myform/';
    var pars = document.forms[0].message0.value + '&' +
document.forms[0].message1.value ;
    var target = 'myAdmantContainer';
    var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters:
</head><div id="myAdmantContainer"></div></body></html>

Does anyone have a vague idea of what to do?

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prototype-scriptaculous+unsubscr...@googlegroups.com.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
Visit this group at http://groups.google.com/group/prototype-scriptaculous.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to