|
|
|
|
|
|
|
|
|
|
|
|
|
|
Using JavaScript to get the Query_String from a frameset (continued)
Assigning the parameter values to fields on the form Now that you have the value of the parameter that's been passed to the form, you probably want to assign it to a field value. There is a key thing to note here and that is if you want to assign a value to a field on a form using JavaScript, the field must be editable, and included on the form. Editable is straightforward enough, but there are three ways to include the field on the form.
- Just put the field on the form and make sure it's not hidden;
- Put the field on the form, hide it, and then make sure you have the "Generate HTML for all fields" box checked at the bottom of the form's beanie-hat property tab;
- Put a regular Notes field on the form and hide it from Web users. Then put the following code on your form, mark it as pass-thru HTML, and hide it from Notes users.
Here's the code snippet:
<INPUT NAME="ProductName" TYPE=hidden>
|
I used the third method because I was getting errors when I used the "Generate HTML for all fields" option since my forms were inheriting values from the previous forms. You can try and see what works best for you.
In order to assign the parameter value you've just extracted from the Query_String to a field on your form you need to put the JavaScript code below in the onLoad section of your form.
if ( productName != "null" ) {
document.forms[0].ProductName.value = trim ( productName );
} else {
document.forms[0].ProductName.value = '';
}
|
The final step: customizing the page There is one final step in making this all work. Now that you've gotten the parameter values from the frameset Query_String and assigned them to the form, you need to be able to display a custom message on the form. Well, as you may or may not have already figured out, you can't use a computed field or computed text since the values are not available to you. They have been newly assigned on the form and are editable. Therefore, you need to use JavaScript once again to put the finishing touches on your page. Here's some sample code that uses JavaScript to display the product name and logo (the logo file name is the same on all the forms) on the page. Note that you'll either have to compute the dbPath variable mentioned below on the form (in the JS Header or onLoad section) or hard-code it. Mark the following code as pass-thru HTML and place it where you want the text and logo to appear on the form.
<script language=javascript>
if (productName != "null") {
document.write ( "<table border=0 width=460 cellpadding=10><tr><td valign=top width=280><font face=Arial size=2>Welcome to Our Corporation. Here you can purchase products such as " + productName + " as well as other products.</font></td><td align=center valign=top width=180><IMG SRC=\"/" + dbPath + "/gateway/" + productNameLink + "/$FILE/logo.gif\"></td></tr></table>" )
}
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Advertisement --
Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done.
Native to Lotus Domino. The User Experience unseen for Lotus Domino.
Do more with less. Really.
See the possibilities Docova unleashes for Lotus Domino. |
-- Advertisement --
Teamstudio Edition 25 has shipped
It's finally here! Now that Teamstudio Edition 25 has shipped, listen to our latest Tool Time audio program to find out what's changed. Updates to all your favorite Teamstudio tools will be discussed.
Plus, you'll get an introduction to Teamstudio Undo (formerly known as Teamstudio Snapper).
Tap here to get started! |
|
|
|
|
|
|
|
|
|
|