Anonymous_User Absent Member.
Absent Member.
230 views

Form HTML Fields


Is there a way to stop the engine from automatically closing HTML tags defined in type HTML fields?


i.e.:


Field1:

(function () {return "<div id=\'mydiv\">";} ) ();


Field2:

Some input or something


Field3:

(function () {return "</div";} ) ();


The problem is that the engine automatically closes the DIV in Field1! Pain!



Labels (1)
0 Likes
6 Replies
Anonymous_User Absent Member.
Absent Member.

Re: Form HTML Fields


A sligthly different approach:

why not just make an empty div like this: (function () {return "<div
id=myDiv></div>";} ) ();
Of some reason the engine adds "" around all id tag values even though
you have already added one yourself. So if you just leave out the ""
around the id value the engine will do this it self.

With the empty div you can now just use regular javascript and/or either
DOJO or jQuery to just fill in the needed data inside the div when
nescercary.


--
Kerasit
------------------------------------------------------------------------
Kerasit's Profile: https://forums.netiq.com/member.php?userid=6043
View this thread: https://forums.netiq.com/showthread.php?t=49930

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Form HTML Fields


Nope, that won't work for what I'm after...





>>> Kerasit<Kerasit@no-mx.forums.netiq.com> 7/02/2014 10:56 PM >>>



A sligthly different approach:



why not just make an empty div like this: (function () {return "<div

id=myDiv></div>";} ) ();

Of some reason the engine adds "" around all id tag values even though

you have already added one yourself. So if you just leave out the ""

around the id value the engine will do this it self.



With the empty div you can now just use regular javascript and/or either

DOJO or jQuery to just fill in the needed data inside the div when

nescercary.





--

Kerasit

------------------------------------------------------------------------

Kerasit's Profile: https://forums.netiq.com/member.php?userid=6043

View this thread: https://forums.netiq.com/showthread.php?t=49930





0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Form HTML Fields


From what I could tell by the very limited information you have provided
you would like to either:

a:
dynamically generate the content of the HTML field where you creates a
div and populates some data.

b:
You would like to encapsulate fields and/or generated HTML from the UA
standard form behavior in your own HTML div.

If a then there is nothing preventing you from using the method I
provided.

If b then you cannot do the desired due to the UA bultin behavior
(Validating and correcting the HTML).
But you can still acheive what you are after with a different approach,
leaving you must better and harder control of your code. However be
aware that this method might not be supported...Directly.

Just create all the standard UA form fields you would like to
"encapsulate" in your div, including all the needed events and
commands.
Then make sure that all those fields are hided.
Now all you has to do when the form is already loaded (put this in the
onload activity for your very first field because the order of how the
fields is loaded is backwards, so the last field is loaded first).

setValue("yourHTMLField", "<div id=myDiv><table
id=myDivTable></table></div>");

now use any favourite JavaScript toolbox (I recommend either jQuery or
DOJO) to move (place) all the desired UA form fields inside the table in
your div.
With dojo:

dojo.place(dojo.byId("_MyFieldName1").parentNode.parentNode,
"myDivTable");
dojo.place(dojo.byId("_MyFieldName2").parentNode.parentNode,
"myDivTable");
.....

This way you moves the entire <tr> with the standard created UA form
fields which ensures full support for the standard behaviors
(dateTimePickers, lists, pickLists, dn fields etc.).

Just remember to use this when you wants to show the fields:
dojo.attr(dojo.byId("_MyFieldName1").parentNode.parentNode, "style",
{display: "inline"});
dojo.attr(dojo.byId("_MyFieldName2").parentNode.parentNode, "style",
{display: "inline"});
....

You could also just use the builtin to show them:
form.show("MyFieldName1");
But of some reason there will be a lot of dumb breaklines with only
nothing to show for it in your form with the standard show/hide
functionality. Manipulating directly with the display style eleminates
this.

With jQuery you can do the same but jQuery is not my strongest side.


--
Kerasit
------------------------------------------------------------------------
Kerasit's Profile: https://forums.netiq.com/member.php?userid=6043
View this thread: https://forums.netiq.com/showthread.php?t=49930

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Form HTML Fields


Thanks for the suggestion and code options...


It can still be a lot of work (especially when form may have a large number of fields, some of which display dependent on other content selection), when really this *should* be an easily implementable solution without all this extra work....







>>> Kerasit<Kerasit@no-mx.forums.netiq.com> 10/02/2014 8:14 PM >>>



From what I could tell by the very limited information you have provided

you would like to either:



a:

dynamically generate the content of the HTML field where you creates a

div and populates some data.



b:

You would like to encapsulate fields and/or generated HTML from the UA

standard form behavior in your own HTML div.



If a then there is nothing preventing you from using the method I

provided.



If b then you cannot do the desired due to the UA bultin behavior

(Validating and correcting the HTML).

But you can still acheive what you are after with a different approach,

leaving you must better and harder control of your code. However be

aware that this method might not be supported...Directly.



Just create all the standard UA form fields you would like to

"encapsulate" in your div, including all the needed events and

commands.

Then make sure that all those fields are hided.

Now all you has to do when the form is already loaded (put this in the

onload activity for your very first field because the order of how the

fields is loaded is backwards, so the last field is loaded first).



setValue("yourHTMLField", "<div id=myDiv><table

id=myDivTable></table></div>");



now use any favourite JavaScript toolbox (I recommend either jQuery or

DOJO) to move (place) all the desired UA form fields inside the table in

your div.

With dojo:



dojo.place(dojo.byId("_MyFieldName1").parentNode.parentNode,

"myDivTable");

dojo.place(dojo.byId("_MyFieldName2").parentNode.parentNode,

"myDivTable");

....



This way you moves the entire <tr> with the standard created UA form

fields which ensures full support for the standard behaviors

(dateTimePickers, lists, pickLists, dn fields etc.).



Just remember to use this when you wants to show the fields:

dojo.attr(dojo.byId("_MyFieldName1").parentNode.parentNode, "style",

{display: "inline"});

dojo.attr(dojo.byId("_MyFieldName2").parentNode.parentNode, "style",

{display: "inline"});

...



You could also just use the builtin to show them:

form.show("MyFieldName1");

But of some reason there will be a lot of dumb breaklines with only

nothing to show for it in your form with the standard show/hide

functionality. Manipulating directly with the display style eleminates

this.



With jQuery you can do the same but jQuery is not my strongest side.





--

Kerasit

------------------------------------------------------------------------

Kerasit's Profile: https://forums.netiq.com/member.php?userid=6043

View this thread: https://forums.netiq.com/showthread.php?t=49930





0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Form HTML Fields


But it is not something that should be easily implemented:

Every field in a form is to be considered as independent because they
are created as widgets (through the framework implemented). That means
that any field works as a seperate accessible object.
If treated differently (hence what we actually tries here by nesting
them) might break the objects. The same thing with a HTML field. It is
still created as an object with all there is to it (handles, commands,
parameters, event layer etc.). That means that the controls (which is
the fields but created through the engines standard features now makes
them as controls) will always be created as whole objects. This also
includes checks and verifications that the objects do not break the HTML
document. So no, it should not be fixed because that would break the
framework which UA it self is totaly depending on and potentialy
breaking the UA standard interface (because now the controls object
(widget) handling is broken).


--
Kerasit
------------------------------------------------------------------------
Kerasit's Profile: https://forums.netiq.com/member.php?userid=6043
View this thread: https://forums.netiq.com/showthread.php?t=49930

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Form HTML Fields

If you share with us what you try to accomplish by injecting the tags,
we might point to to alternative approaches/solutions

Wolfgang

On 07.02.2014 00:44, ScorpionSting wrote:
> Is there a way to stop the engine from automatically closing HTML tags
> defined in type HTML fields?
> i.e.:
> Field1:
> (function () {return "<div id=\'mydiv\">";} ) ();
> Field2:
> Some input or something
> Field3:
> (function () {return "</div";} ) ();
> The problem is that the engine automatically closes the DIV in Field1! Pain!
>

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.