[Proto-Scripty] Re: How to make id added by ajaxUpdater visible to the rest of the page

2010-05-19 Thread Magnus Johnson
Hello!

Thank you for your reply. Sorry if my post was messy. I will try to
reformulate a little to see if I am able to make my problem possible
to understand.

What I want to do is to have a table that can be edited (possible to
add and remove rows using Prototype) and in in the fields in this
table I want to use auto suggest (auto suggest is probably the right
term instead of auto complete as I wrote previously). When the user
starts typing something in a field, suggestions with entries already
existing in the database are shown in a list. So the database is not
modified in any way by the auto suggest.

However, when I add a new field to my table by using prototype, the
auto suggest does not work in the modified parts of the table. I have
confirmed the the code in the modified table is correct, but auto
suggest does not work there.

I then found the site: http://www.prototypejs.org/api/ajax/updater. An
excerpt from that page about evalScripts and defining functions says:
The local scope will be that of Prototype's internal processing
function. Anything in your script declared with var will be discarded
momentarily after evaluation, and at any rate will be invisible to the
remainder of the page scripts. From that I thought that the modified
part of the table is probably invisible to the rest of my page, where
I for example have my auto suggest script located. I am not sure this
conclusion is correct, but it agrees well with what I have seen.

Any comments about that?

Thanks!

/Magnus

On May 17, 5:44 pm, Jinsa jf.wesq...@gmail.com wrote:
 Hellow!

 I tried to understand your problem and what comes out from your post
 is: it's messy.

 I don't have a solution for your problem but I'll try to help you as
 much as I can. What I'll try is to show you is the path to make your
 script works.

 So, First, let us explain what you want:
 You have a table and you want it to be editable with an auto-
 completion on fields.

 Second, how it should be handled in order to make it editable:
    - OnFocus Field - function Ajax.AutoCompleter (prototype based or
 your script, as you want :).
    - OnSubmit Field - function OnClick launching a new function in
 order to launch two things:
           - Update the database (giving all information needed like
 id, value, token etc.). Using form.request pointing to a php file with
 a mysql querry.
           - Once database updated you need to update your table. Using
 ajax.updater to get your fresh table and to put it over your old table

 That's it, no more. I hope it helps you a bit, if not... what a shame!
 ^^

 Have a nice day,

 Jinsa.

 On May 16, 10:45 am, Magnus Johnson magnus.x.john...@gmail.com
 wrote:



  Hello,

  I am using ajaxUpdater to allow the user to add an arbitrary number of
  rows to a table. Then the user feeds in data into each field in the
  table. This part works excellent. The problem I run into is when I
  want to use ajax auto complete in in column 1 on each row in the
  table. I am using the following tool for 
  this:http://freeajaxscripts.net/directory/Ajax_auto_complete/Gagandeep_Sin

  In a static table (not modified by ajaxUpdater) this also works
  excellent. However when I add a new row to my table, the auto complete
  does not work on the rows added by ajaxUpdater.

  My code for the table looks like this:
  echo form action=\$currentfile\ method=\get\ class=\asholder
  \;
  echo table id=\mytable\ class=\bluetable\;
  echo trthColumn 1/ththColumn 2/th/tr;
  echo tr id='row1'  td input type=\text\ name=\name[]\ id=
  \testinput1\ value=\\ /td;
  echo td input type=\text\ name=\amount[]\ value=\\ /td;
  echo td a href=\\ onmousedown=
  \ajaxUpdater('row1','change_row.php?remove')\ img src=\b_drop.png
  \/ /a /td/tr;
  echo /table;
  echo /form;
  And a button to add new rows to the table:
  echo input type=\button\ value=\New row\ onClick=
  \ajaxInserter('mytable','change_row.php?add')\;

  When I add a new row by using the php script change_row.php I change
  the id to testinput2, testinput3 and so on. This is the id that the
  ajax auto complete triggers on, but it does not :-(.

  I am quite stuck here so any help would be appreciated.

  /Magnus

  --
  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 
  athttp://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 
 athttp://groups.google.com/group/prototype

[Proto-Scripty] How to make id added by ajaxUpdater visible to the rest of the page

2010-05-16 Thread Magnus Johnson
Hello,

I am using ajaxUpdater to allow the user to add an arbitrary number of
rows to a table. Then the user feeds in data into each field in the
table. This part works excellent. The problem I run into is when I
want to use ajax auto complete in in column 1 on each row in the
table. I am using the following tool for this:
http://freeajaxscripts.net/directory/Ajax_auto_complete/Gagandeep_Singh/details.html.

In a static table (not modified by ajaxUpdater) this also works
excellent. However when I add a new row to my table, the auto complete
does not work on the rows added by ajaxUpdater.

My code for the table looks like this:
echo form action=\$currentfile\ method=\get\ class=\asholder
\;
echo table id=\mytable\ class=\bluetable\;
echo trthColumn 1/ththColumn 2/th/tr;
echo tr id='row1'  td input type=\text\ name=\name[]\ id=
\testinput1\ value=\\ /td;
echo td input type=\text\ name=\amount[]\ value=\\ /td;
echo td a href=\\ onmousedown=
\ajaxUpdater('row1','change_row.php?remove')\ img src=\b_drop.png
\/ /a /td/tr;
echo /table;
echo /form;
And a button to add new rows to the table:
echo input type=\button\ value=\New row\ onClick=
\ajaxInserter('mytable','change_row.php?add')\;

When I add a new row by using the php script change_row.php I change
the id to testinput2, testinput3 and so on. This is the id that the
ajax auto complete triggers on, but it does not :-(.

I am quite stuck here so any help would be appreciated.

/Magnus

-- 
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.