Re: [Proto-Scripty] Wow, really new at this

2010-01-04 Thread Alex McAuley
Can you show us the observer that calls submitAJAX(id) ?


Alex Mcauley
http://www.thevacancymarket.com


- Original Message - 
From: E emiliano.jor...@templatecascade.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Monday, January 04, 2010 12:50 AM
Subject: [Proto-Scripty] Wow, really new at this


 Taking my first tentative steps in JavaScript and I have a stumbling
 block I can't get past.  I'm trying to submit an HTML form using the
 Ajax.Updater().  I have multiple versions of very similar forms on the
 same page and would like to seperate them by using a unique ID.

 My Javascript function is:

 function submitAJAX(id){
 var url = 'product_process.php';
 var price = escape($('products_price'+id));
 var price_w = escape($('products_price_w'+id));
 var pars = 'product=' + price + 'price=' + price + 'wprice=' +
 price_w;
 var target = 'output-div' + id;
 var myAjax = new Ajax.Updater(target, url, {method: 'get',
 parameters: pars});

 }


 The working part of my form looks something like this.

 form name=product_update117 action=products.php method=post
 input type=text name=products_price117 value=25.
 id=products_price117
 input type=text name=products_price_w117 value=12.5000
 id=products_price117

 /form


 I can't pull the values from product_update117 using what I am. But I
 need to somehow have multiple forms for multiple IDs created
 dynamically.  My whole approach might be wrong.  Or it just might be
 my inexperience with JavaScript. But after two days I can't figure it
 out.  I'm in the deep end.

 --

 You received this message because you are subscribed to the Google Groups 
 Prototype  script.aculo.us group.
 To post to this group, send email to 
 prototype-scriptacul...@googlegroups.com.
 To unsubscribe from this group, send email to 
 prototype-scriptaculous+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/prototype-scriptaculous?hl=en.


 

--

You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: BlindDown/Up rendering wrong

2010-01-04 Thread Lenni
For future reference:

I just found out what triggered the the funny rendering: BlindUp was
called whilst BlindDown was still rendering. That obviously caused
problems.  Now BlindUp waits until BlindDown is finished.

On Dec 22 2009, 7:26 pm, david david.brill...@gmail.com wrote:
 Hi Lenni,

 Do you have any code whe can play with ??
 the HTML used and CSS applyied on HTML element :))

 --
 david

 On 21 déc, 15:01, Lenni leonard.ehrenfr...@web.de wrote:

  Hi,

  I'm trying to use the BlindDown/Up effect but it it renders stuttery
  and weird on all the major (FF 3.5, IE 8, Chrome 4) Browsers.
  Basically, the background div that is is referenced in the function
  call, doesn't extend all the way down. It's contents are shown fine.
  Also, it works fine for the first time, but every susequent BlindDown
  is borked.

  Screenshot:http://www.flickr.com/photos/24003...@n00/4203465158/sizes/o/

  My suspicion is that there is some stray CSS that the effect doesn't
  aggree with, but I played around with it in Firebug but couldn't get
  to the bottom of it.

  I did make one observation though: Whenever I roll the div up, even in
  the hidden state it still has a height CSS attribute with a value of
  something like 80px. If I manually remove the attribute the BlindDown
  looks as intended.

  Anybody care to enlighten me as to what I'm doing wrong?

--

You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Wow, really new at this

2010-01-04 Thread Al C
In the sample code above, I suspect that you've given the wrong id the
second input field...

With that oops mistake corrected, I strongly recommend that (if you've
not already done so), get Firefox and install the latest Firebug add-
in (and I also recommend the Web Developer toolbar).  I've found these
to be incredibly useful as I've wrestled with Prototype.  Firebug will
allow you to observer all of the AJAX HTTP requests in your code.
Chrome and IE also have some limited developer tools but IMHO, Firebug
is the most comprehensive and is easiest to use.

Using Firebug with your form and script above, I get the following
request in Firebug's console window:

   ihttp://localhost/test/product_process.php?product=%5Bobject
%20HTMLInputElement%5Dprice=%5Bobject%20HTMLInputElement
%5Dwprice=null/i

From that it is obvious (ha ha ha) that your Javascript statement:
  var price = escape($('products_price'+id));
is returning the object rather than the value of the object - i.e. you
probably want
  var price = escape($('products_price'+id).value);
or (slightly shorter)
  var price = escape($F('products_price'+id));  //$F('id) is an
abbreviation for $('id').value

Of course, prototype gives you many ways to skin the cat...
You can add an id attribute to your forms - e.g.,
  form name=product_update117 id=product_update117
action=products.php method=post
  form name=product_update118 id=product_update118
action=products.php method=post
  form name=product_update123 id=product_update123
action=products.php method=post
   etc...
and then you can get all of the values in the form into a query string
via
  var pars = $( product_update + id ).serialize( );

However, to make this efficient on the receiving end, you probably
want to simplify the id's of the input fields so that they are the
same for all form (which will violate all sorts of rules relating to
id's supposedly being unique on the page)... its hard to tell how to
best handle this without knowing more about the code at the far end.

One last recommendation, bookmark the following link: 
http://www.prototypejs.org/api...
(I'd be lost without it ;-)

Hope this helps,

Al

On Jan 3, 7:50 pm, E emiliano.jor...@templatecascade.com wrote:
 Taking my first tentative steps in JavaScript and I have a stumbling
 block I can't get past.  I'm trying to submit an HTML form using the
 Ajax.Updater().  I have multiple versions of very similar forms on the
 same page and would like to seperate them by using a unique ID.

 My Javascript function is:

 function submitAJAX(id){
         var url = 'product_process.php';
         var price = escape($('products_price'+id));
         var price_w = escape($('products_price_w'+id));
         var pars = 'product=' + price + 'price=' + price + 'wprice=' +
 price_w;
         var target = 'output-div' + id;
         var myAjax = new Ajax.Updater(target, url, {method: 'get',
 parameters: pars});

 }

 The working part of my form looks something like this.

 form name=product_update117 action=products.php method=post
 input type=text name=products_price117 value=25.
 id=products_price117
 input type=text name=products_price_w117 value=12.5000
 id=products_price117

 /form

 I can't pull the values from product_update117 using what I am. But I
 need to somehow have multiple forms for multiple IDs created
 dynamically.  My whole approach might be wrong.  Or it just might be
 my inexperience with JavaScript. But after two days I can't figure it
 out.  I'm in the deep end.

--

You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.