Hello.
This is the first time I've posted a question on the forum, so please
inform me if I lacked any details in my question.
Context:
I am trying to add a new function that lets a non-technical user do
simple text formating on a form on a html page. A user can press
buttons to bold/italic/underline text in a form.
I have got its interface working and am trying to incorporate it into
the notes module. Within the file /web/eric4/packages/notes/www/add-
edit.tcl I've replaced the 2 "-widget" calls (ie
template::element ...) by:
template::element create new_note title
-widget editor
-datatype text
-label "Title"
-html { height 100 width 180
src /web/eric4/packages/notes/www/title.html }
-value $title
template::element create new_note body
-widget editor
-datatype text
-label "Body"
-html { height 160 width 350
src /web/eric4/packages/notes/www/body.html }
-value $body
"-widget editor" refers to a new block of code I've added to
file: /web/eric4/packages/acs-templating/tcl/widget-procs.tcl . The
code is "ad_proc -public template::widget::editor ... " in file: widget-
procs.tcl
or widget-
procs.tcl
For the moment, it only works for Internet Explorer 4.0 or above,
and I've left room for future development for Netscape.
Question 1:
For module notes now to update content after the submit button is
pressed, it would have to recognise that it's now talking to an
iframe (iframe's innerhtml) rather than, say, a textarea. However, I
have trouble understanding the form templates which add-edit.tcl in
notes/www use:
if [template::form is_valid new_note] {
set user_id [ad_conn user_id]
set peeraddr [ad_conn peeraddr]
if [info exists note_id] {
db_dml note_update {
update notes
set title = :title,
body = :body
where note_id = :note_id
}
} else {
db_exec_plsql new_note {
declare
id integer;
begin
id := note.new(
owner_id => :user_id,
title => :title,
body => :body,
creation_user => :user_id,
creation_ip => :peeraddr,
context_id => :package_id
);
end;
}
}
ad_returnredirect "."
}
And more specifically the meaning of ':' before 'title', 'body'
etc. If I can assign the content of the iframe's innerhtml and
assign it to the sql string, I think I am there.
Question 2
Altough I keep updating the file the iframe is sourcing from (ie.
src=body.html), because the filename does not change, the browser
kept displaying the cached body.html content inside the iframe. I've
already used the tag: (meta http-equiv="Refresh" content="5") but
without success. Any ideas?
Thanks for your help in advance. And I would really appreciate
any opinion on whether or not I am on the right track. :)
Eric