PDA

View Full Version : Setting dynamic content on an HTMLForm super control


ABC123

Mike Thomson
02-29-2008, 02:14 AM
My undestanding from reading "Whats new" notes is that you can embed a new A5 tag such as the one below into the HTML body of the control

<a5:dynamicContent expression="dynamicContentMyText"/>
Here is some static test

If I have (say a button) a control on the form and want to set the value of the HTML content , you could run xbasic such as

dynamicContentMyText="This is my replaced text"

I have tried this and not got it to work

Any ideas?

PS: Being able to refer to the embedded html form by using DOM.getelementbyid should also work. But what do I set DOM to so I can refer to the HTML object? Note: Have tried obj=obj({name of html form control})

Selwyn Rabins
02-29-2008, 11:20 AM
My undestanding from reading "Whats new" notes is that you can embed a new A5 tag such as the one below into the HTML body of the control

<a5:dynamicContent expression="dynamicContentMyText"/>
Here is some static test

If I have (say a button) a control on the form and want to set the value of the HTML content , you could run xbasic such as

dynamicContentMyText="This is my replaced text"

I have tried this and not got it to work

Any ideas?

PS: Being able to refer to the embedded html form by using DOM.getelementbyid should also work. But what do I set DOM to so I can refer to the HTML object? Note: Have tried obj=obj({name of html form control})


Here is an example of what you are trying to do. In this case the HTML Form is in an Xdialog, but it should work the same if you have the dynamic content in a form:



'Create an XDialog dialog box to prompt for parameters.
DIM SHARED varC_result as C
myvalue = "this is the dynamic content"
DIM html as p
DIM html.html as c
DIM html.css as c
DIM html.linkedFiles as c
DIM html.events as c
html.html = <<%html%
<a5:bindings>
</a5:bindings>
<a5:propertyExpressions>
</a5:propertyExpressions>
<a5:dynamicContent expression="myvalue" />
%html%
html.css = <<%css%
%css%
html.linkedFiles = <<%str%
%str%
html.events = <<%code%
%code%
ok_button_label = "&OK"
cancel_button_label = "&Cancel"
varC_result = ui_dlg_box("Alpha Five",<<%dlg%
{region}
{HTMLForm=40,5html};
{endregion};
{line=1,0};
{region}
<Set Content!set>
{endregion};
%dlg%,<<%code%
if a_dlg_button = "set" then
a_dlg_button = ""
dim txt as c
txt = ui_get_text("new content","enter the new content for the dynamic html region:")
if txt <> "" then
myvalue = txt
end if
end if
%code%)

Selwyn Rabins
02-29-2008, 11:23 AM
Here is another example when the html button's label is dynamic:



'Create an XDialog dialog box to prompt for parameters.
DIM SHARED varC_result as C
myvalue = "this is the dynamic content"
DIM html as p
DIM html.html as c
DIM html.css as c
DIM html.linkedFiles as c
DIM html.events as c
html.html = <<%html%
<a5:bindings>
</a5:bindings>
<a5:propertyExpressions>
</a5:propertyExpressions>
<button>
<a5:dynamicContent expression="myvalue" />
</button>
%html%
html.css = <<%css%
%css%
html.linkedFiles = <<%str%
%str%
html.events = <<%code%
%code%
ok_button_label = "&OK"
cancel_button_label = "&Cancel"
varC_result = ui_dlg_box("Alpha Five",<<%dlg%
{region}
{HTMLForm=140,15html};
{endregion};
{line=1,0};
{region}
<Set Content!set>
{endregion};
%dlg%,<<%code%
if a_dlg_button = "set" then
a_dlg_button = ""
dim txt as c
txt = ui_get_text("new content","enter the new content for the dynamic html region:")
if txt <> "" then
myvalue = txt
end if
end if
%code%)

Selwyn Rabins
02-29-2008, 11:26 AM
Here is another example. In this case I created a Supercontrol on a form (HTML Form supercontrol).

The form was based on the customer table in Alphasports.

the HTML form was defined as:


<button>
<a5:dynamicContent expression="Firstname"/>
</button>

When I ran the form, the button label changed as I navigated from record to record.

Mike Thomson
02-29-2008, 08:22 PM
Thanks for these examples Selwyn - they are useful to study
My problem however still remains in relation for html on form (and not xdialog). For instance I have the following form

http://msgboard.alphasoftware.com/alphaforum/attachment.php?attachmentid=16407&stc=1&d=1204330221

I have defined intital code as follows

http://msgboard.alphasoftware.com/alphaforum/attachment.php?attachmentid=16406&stc=1&d=1204330221

And HTML as follows

http://msgboard.alphasoftware.com/alphaforum/attachment.php?attachmentid=16408&stc=1&d=1204330424

the button on push event is set to

myvalue="This is modified text"

When I run this form I get the following

http://msgboard.alphasoftware.com/alphaforum/attachment.php?attachmentid=16409&d=1204331058

Selwyn Rabins
02-29-2008, 11:49 PM
Thanks for these examples Selwyn - they are useful to study
My problem however still remains in relation for html on form (and not xdialog). For instance I have the following form

http://msgboard.alphasoftware.com/alphaforum/attachment.php?attachmentid=16407&stc=1&d=1204330221

I have defined intital code as follows

http://msgboard.alphasoftware.com/alphaforum/attachment.php?attachmentid=16406&stc=1&d=1204330221

And HTML as follows

http://msgboard.alphasoftware.com/alphaforum/attachment.php?attachmentid=16408&stc=1&d=1204330424

the button on push event is set to

myvalue="This is modified text"

When I run this form I get the following

http://msgboard.alphasoftware.com/alphaforum/attachment.php?attachmentid=16409&d=1204331058

OK, thanks, in the context of a HTML Form supercontrol, embedded in a form, I can repeat the problem. Binding to a field in the form's table works. But binding to a global, does not seem to work. We will fix it.

Edward W Larrabee
07-06-2008, 06:52 PM
Perhaps this is relevant to my question. I placed a webcontent supercontrol on a form. Its content is defined by a global variable, which contains the name of local HTML file. It loads the file successfully, but I cannot figure out how to refresh the page. I really need a code example of the webcontent refresh method.

-ed