Hi there,
To pass all the values through pages
1. Use Ajax
Every input box will be submited on real time. After the user stop editing the new translation message, the box is submited using Ajax New Request
new Ajax.Request('translate-message',{asynchronous:true,method:'post',parameters:'return_url=@return_url@&message_key=@messages.message_key&message_value=@message_value@});
2. Create a structure: array or list to pass the values (FAILED)
I dont know how to manipulate arrays within multirows
3. Make the input field's name as the respective message_key
I have a bunch of input fields within a form (the number and names of the fields can vary. They are dynamic).
I want to send them to another page.
The form gets filled from a template::list.
The list has one of the elements as described bellow:
...
translated_text {
label "Translation"
display_template {
if @messages.translated_p@ false
input type="text" name="@messages.message_key;noquote@"
/if
else
@messages.translated_text@
/else
}
The name of every input field is the message_key of a respective message.
Then the multirow is :
multirow create messages message_key orig_text translated_text translate_url translated_p counter msg_keys
foreach message_key [lang::util::get_message_lookups] {
.
.
.
if {!$translated_p} {
lappend msg_keys $message_key
incr counter
}
multirow append messages $message_key $orig_text $translated_text $translate_url $translated_p $counter $msg_keys
}
The form as in the ADP page
form action="/acs-lang/translation-edit" method="POST" name="form"
listtemplate name="messages"/listtemplate
input type="submit" name="submit" value="Translate All"
/form
Now, in the other page i've written the following bellow only to see if the values have been passed through pages.
ad_page_contract {
Edit i18n tranlations
} {
{msg_keys ""}
}
ns_log Notice "PAGE translation-edit"
set i 0
foreach {msg} $msg_keys {
incr i
ns_log Notice "$i. $msg"
ns_lof Notice ""
}
But i got no errors in the new page. However the variable msg_keys is null and no logs were written at error.log
How would i pass a multidimensional variable through the pages?
I tried also with array as parameter, But it didn't work
ad_page_contract {
Edit i18n translations
} {
{msg_keys:array}
}
[22/Sep/2010:22:49:42][32704.2955893648][-default:10-] Error: rp_report_error: Error rendering error page (!)
can't read "msg_keys": variable is array
while executing
"multirow append messages $message_key $orig_text $translated_text $translate_url $translated_p $counter $msg_keys"
("foreach" body line 20)
invoked from within
"foreach message_key [lang::util::get_message_lookups] {
set locale [ad_conn locale]
# Extra args mean no substitution
set or..."
("uplevel" body line 49)
invoked from within
"uplevel {
set locale [ad_conn locale]
set display_p [expr {[lang::util::translator_mode_p] && [ad_conn locale] ne "en_US" }]
array set msg_values {}..."
(procedure "code::tcl::/var/www/projop/projop/packages/acs-lang/lib/mess..." line 2)
invoked from with