Search DominoPower's 11,443 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
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>


« Previous  ·  1  ·  2  ·  3  ·  4  ·  5  ·  Next »
Other articles you might like
Home > Internet Technologies > JavaScript (13 articles)
   Sorting your Domino views with JavaScript
   Give your Domino views life with DHTML
   Using dynamically generated HTML to thwart spam email address harvesting
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Syncing Notes with Android phones
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: Online safety for virtual learning
David Gewirtz Online: CNN commentary and analysis
OutlookPower: Seek and find: Strategies to locate filed-away emails fast
-- 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!

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login