Hello,
Is it not possible to have multiple arguments in the "onload" event of a New/Edit page? It doesn't work with multiple arguments but it does work with just one argument i.e. document.theForm.
Eg: if(typeof clearlistAndUpdateField == 'function')
clearlistAndUpdateField(arg1, arg2, arg3);
Kindly let me know.
With the following in onLoad for the page:
if(typeof clearlistAndUpdateField == 'function')
{
clearlistAndUpdateField(document.theForm, 'a value', 'another value');
}
and following script component in the page:
<script>
function clearlistAndUpdateField(form, arg2, arg3) {
console.log(form);
console.log(arg2);
console.log(arg3);
}
</script>
I get the following result:
<form action="../servlet/Object" method="post" name="theForm" enctype="multipart/form-data" onsubmit="rbf_disableAllButtons()">…</form>
a value
another value
The onLoad text (object definition > page definition > properties) area shown can contain arbitrary javascript content. There is really no restriction on the arguments for an onLoad function. Where do you get values for your arg2 and arg3?
Hi,
Have you tried having curly braces "{}" in your if statement and inside it is your multiple arguments?
Regards,
Orchid
Hi IramK,
Please share the complete JS code that you are using. Will help us understand the problem better.
Yes I have tried using curly braces in my if statement but my function still doesn't work.
[mention:7e24e60fbecc4ff8baf4669a65bae0a0:e9ed411860ed4f2ba0265705b8793d05] : The onload function is similar to the function given above and the function declaration is as given below:
Onload:
if(typeof clearlistAndUpdateField == 'function') { clearlistAndUpdateField(document.theForm, arg2, arg3); }
JS Code:
<script> function clearlistAndUpdateField(form, arg2, arg3) { form.arg1 = arg2 + arg3; } </script>
With the following in onLoad for the page:
if(typeof clearlistAndUpdateField == 'function')
{
clearlistAndUpdateField(document.theForm, 'a value', 'another value');
}
and following script component in the page:
<script>
function clearlistAndUpdateField(form, arg2, arg3) {
console.log(form);
console.log(arg2);
console.log(arg3);
}
</script>
I get the following result:
<form action="../servlet/Object" method="post" name="theForm" enctype="multipart/form-data" onsubmit="rbf_disableAllButtons()">…</form>
a value
another value
The onLoad text (object definition > page definition > properties) area shown can contain arbitrary javascript content. There is really no restriction on the arguments for an onLoad function. Where do you get values for your arg2 and arg3?
Yes that works. Not sure why it didn't work in the first place. Thanks for clearing it out.