Atozed Forums
Triggering component event from raw text HTML element -- Answered - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: Triggering component event from raw text HTML element -- Answered (/thread-540.html)



Triggering component event from raw text HTML element -- Answered - mdomke - 08-02-2018

Is there a way to trigger an IWControl event from a HTML element created in raw text?

For example, if I create a series of HTML elements, for example anchor tags <a>, using the raw text mode of an IWText component, can I hook the onClick event of that HTML element to an onClick event defined in an IWForm, or the WebApplication for that matter?

I'm trying to create a visually unique navigation and the only way I found I can do this is by using the raw text mode of the IW Text component. I need the HTML elements within the raw text to be interactive and I need that interaction to be managed by the WebApplication session, for example, navigating to another page.

I hope this makes and any insight and especially code examples would be much appreciated.

Many thanks,
Michael


RE: Triggering component event from raw text HTML element - Jose Nilton Pace - 08-02-2018

Hi Michael, YES, you can.

Code:
<a href="#" onclick="return SubmitClick('IWBUTTON1','optional_parameter', false);"><i class="fa fa-calendar fa-fw" aria-hidden="true"></i><span>Agenda</span></a>



RE: Triggering component event from raw text HTML element - joel - 08-02-2018

(08-02-2018, 11:14 AM)José Nilton Pace Wrote: Hi Michael, YES, you can.

Code:
<a href="#" onclick="return SubmitClick('IWBUTTON1','optional_parameter', false);"><i class="fa fa-calendar fa-fw" aria-hidden="true"></i><span>Agenda</span></a>

You can also register a call back 

  WebApplication.RegisterCallBack('fxGridEditCallBack', fxGridEditCallBack);

then in the html do something like this for an ajax call or use the submitclick example above for the non ajax call

            lJS.Add('     var paramlist = "&edittype=0&Agid="+options.gid+"&ArowId="+options.rowId;');
            lJS.Add('     var clk = "executeAjaxEvent(''"+paramlist+"'',null,''fxGridEditCallBack'',true,null,true)";');
            lJS.Add('     return "<a onclick = \"" + clk + "\" href=''#''><img title=''Edit'' src=''/files/Images/default/edit.png''></a>";');


RE: Triggering component event from raw text HTML element - mdomke - 08-04-2018

(08-02-2018, 11:14 AM)José Nilton Pace Wrote: Hi Michael, YES, you can.

Code:
<a href="#" onclick="return SubmitClick('IWBUTTON1','optional_parameter', false);"><i class="fa fa-calendar fa-fw" aria-hidden="true"></i><span>Agenda</span></a>

This worked perfectly. Thank you so much!

Michael


RE: Triggering component event from raw text HTML element -- Answered - DanielFields - 08-06-2018

Please explain a bit more. Does that code display a calendar that calls SubmitClick() on every click?


RE: Triggering component event from raw text HTML element -- Answered - Jose Nilton Pace - 08-06-2018

Hi Daniel, YES, exactly this. A clickable calendar image from fontAwesome, check it here.