Jump to content

UnimHTMLFrame


MOGSY

Recommended Posts

Hi MOSGY
  a simple example:

a) put in the HTMLFrame this code 

<script>
    function callServer(elmnt, event) {
        var HTMLFrame = Ext.getCmp("_HTMLFrame"); 
        var params=[];
        
        switch (elmnt.type) {
            case "text":
                params = ["id="+elmnt.id, "val="+elmnt.value, "xevent="+event ];
                break;
            case "button":
                params = ["id="+elmnt.id, "val="+elmnt.value, "xevent="+event ];
                break;
            case "checkbox":
                params = ["id="+elmnt.id, "val="+elmnt.value, "checked="+elmnt.checked, "xevent="+event ];
                break;
        };
        
        if (params.length>0) {
            ajaxRequest(HTMLFrame, 'callserver', params);
        }
    }
</script>

...
<span> <a href="#" style="text-decoration: none; color:white" onclick="callServer(this,'onclick')">3</a></span>


b) in MainForm you can write the server side code in OnAjaxEvent
 

procedure TMainForm.HTMLFrameAjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
var
  sParam: string;
begin
  if EventName = 'callserver' then
  begin
    sParam := Params['id'].AsString;
    if sParam = 'P' then
    begin
       ...
    end;
  end;
end;



best regards

Link to comment
Share on other sites

36 minutes ago, MOGSY said:

var HTMLFrame = Ext.getCmp("_HTMLFrame");

The value of HTMLFrame from above is undefined. How to get the refernce to HTMLFrame?

Hello,

Please see this demo:

\FMSoft\Framework\uniGUI\Demos\Desktop\ClientEvents-HtmlToAjax
function beforeInit(sender, config)
{
    config.id = '_HTMLFrame';
}

But this example is for the desktop version, try for the mobile too ...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...