Escaping RENDERFORDISPLAY autolinks

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Escaping RENDERFORDISPLAY autolinks

BramVanOosterhout
Hi,

I want to format a topic dataform for edit using RENDERFOREDIT. I used the
following construct:
%RENDERFOREDIT{
  %RENDERFORDISPLAY{ form="Applications/TaskManagementApp.TaskForm"
     autolink="off"
     header=""
     format="$name_value=\"$percentFORMFIELD{ \"$name\"
topic=\"Tasks/TaskId000000\" format=\"$dollarvalue\" }$percent\" "
     separator=""
  }%
  form="Applications/TaskManagementApp/TaskForm"
  format="<h3>$name</h3>$edit$mandatory"
  separator="<br />"
 }%

RENDERFORDISPLAY retrieves the values on the data form for the topic and
creates the field_value="..." parameters for RENDERFOREDIT.
RENDERFOREDIT then renders the form for edit with the existing data.

This does not work because RENDERFORDISPLAY{ autolink="off" } wraps the
formatted output with <noautolink>...</noautolink>. Fair enough, as it is
intended to RENDER.

I worked around this using the following:
%RENDERFOREDIT{
  %EXTRACT{
    text="%RENDERFORDISPLAY{
      form="Applications/TaskManagementApp.TaskForm"
      format="~$name~"
    }%"
  pattern="~(.*?)~"
  format="$1_value=\"$percentFORMFIELD{ \"$1\" topic=\"Tasks/TaskId000000\"
format=\"$dollarvalue\" }$percent\"$n"
}%
  form="Applications/TaskManagementApp/TaskForm"
  format="<h3>$name</h3>$edit$mandatory"
  separator="<br />"
 }%

This works because RENDERFORDISPLAY does not autolink ~WikiWord~ and EXTRACT
does not attempt to render.

But I wonder, Is there a better way?

--
Bram van Oosterhout


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Foswiki-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/foswiki-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Escaping RENDERFORDISPLAY autolinks

Michael Daum-2
Hi Bram,

Bit of overkill.

Try %RENDERFOREDIT{topic="Tasks.TaskId000000"}%

Nothing else. RENDERFOREDIT fetches current values by its own as well as detects the form attached to the topic.

Michael.

On Friday, April 29, 2016 05:23:33 Bram van Oosterhout wrote:

> Hi,
>
> I want to format a topic dataform for edit using RENDERFOREDIT. I used the
> following construct:
> %RENDERFOREDIT{
>   %RENDERFORDISPLAY{ form="Applications/TaskManagementApp.TaskForm"
>      autolink="off"
>      header=""
>      format="$name_value=\"$percentFORMFIELD{ \"$name\"
> topic=\"Tasks/TaskId000000\" format=\"$dollarvalue\" }$percent\" "
>      separator=""
>   }%
>   form="Applications/TaskManagementApp/TaskForm"
>   format="<h3>$name</h3>$edit$mandatory"
>   separator="<br />"
>  }%
>
> RENDERFORDISPLAY retrieves the values on the data form for the topic and
> creates the field_value="..." parameters for RENDERFOREDIT.
> RENDERFOREDIT then renders the form for edit with the existing data.
>
> This does not work because RENDERFORDISPLAY{ autolink="off" } wraps the
> formatted output with <noautolink>...</noautolink>. Fair enough, as it is
> intended to RENDER.
>
> I worked around this using the following:
> %RENDERFOREDIT{
>   %EXTRACT{
>     text="%RENDERFORDISPLAY{
>       form="Applications/TaskManagementApp.TaskForm"
>       format="~$name~"
>     }%"
>   pattern="~(.*?)~"
>   format="$1_value=\"$percentFORMFIELD{ \"$1\" topic=\"Tasks/TaskId000000\"
> format=\"$dollarvalue\" }$percent\"$n"
> }%
>   form="Applications/TaskManagementApp/TaskForm"
>   format="<h3>$name</h3>$edit$mandatory"
>   separator="<br />"
>  }%
>
> This works because RENDERFORDISPLAY does not autolink ~WikiWord~ and EXTRACT
> does not attempt to render.
>
> But I wonder, Is there a better way?
>
> --
> Bram van Oosterhout
>
>
> ------------------------------------------------------------------------------
> Find and fix application performance issues faster with Applications Manager
> Applications Manager provides deep performance insights into multiple tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
> _______________________________________________
> Foswiki-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/foswiki-discuss

--
-- Michael Daum Consulting
-- Wissensmanagement und Intranet-Technologie
-- https://michaeldaumconsulting.com
-- Tel: +49 (0)40 21 99 27 51

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Foswiki-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/foswiki-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Escaping RENDERFORDISPLAY autolinks

BramVanOosterhout
In reply to this post by BramVanOosterhout
Hi Michael,

Saw your response on the forum. It never made it to my inbox. I sure
overcooked the implementation!

Thanks for the pointer. It does  simplify the rendering substantially.

All the best.

--
Bram van Oosterhout


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Foswiki-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/foswiki-discuss