[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Can't access domino field in javascript

Posted on 2009-02-23
7
Medium Priority
?
824 Views
Last Modified: 2013-11-16
I am trying to access a domino field in javascript, but it's not working, I keep getting the error in Internet Explorer 7 that it's "null or not an object". I tried to make a simple example where I just display the value (see code below).  I have checked the "Create HTML for all fields" option and even put in Edit mode to check if that was the problem.
<script language="Javascript" type="text/javascript">
document.write(document.forms[0].CourseType.value)
</script>

Open in new window

0
Comment
Question by:kasperEH
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 23711932
1) What type of field is CourseType? It might not have a Value property. Start with just a text-field.
2) Why document.write()? It is evaluated directly when the page is loaded, and at that time the value of CourseType is probably empty. Better use the alert() functuon, or add some button with an alert.
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 23711967
Make sure that the field has the Id set on the HTML properties tab.  The Id should be the same as the field's name.
0
 
LVL 13

Assisted Solution

by:CRAK
CRAK earned 300 total points
ID: 23712292
Take a look at the output in HTML (View Design) and search for the field name. It's easier to work from there.
Text fields have a value. Radio buttons, checkboxes, listboxes etc. need to be addressed differently. E.g: do you get <SELECT...> instead of <INPUT...>?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 13

Expert Comment

by:CRAK
ID: 23714807
(correction: view source)
0
 

Author Comment

by:kasperEH
ID: 23719371
To sjef_bosman: CourseType is a dialog list field. The documents are created in the Notes client and viewed (by most users) in the browser.
As the document has already been saved, I think the field should be there when document.write is evaluated.
To Bill_Hanson: I have set the id now on the HTML properties tab and it still doesn't work.
To CRAK: The field looks like this in the HTML: <input name="CourseType" type="hidden" value="Intro programme">
But it appears after my JavaScript, so this might be the problem. But why is it like this when the CourseType field is at the top of the form and the JavaScript code in the bottom?
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 450 total points
ID: 23719746
So it's not a text field. A dialog list is converted into a Select in HTML. The Select doesn't have a value property. Instead, it has the selectedIndex property. Here are some interesting examples:

http://www.javascriptkit.com/jsref/select.shtml

Although, the HTML line you added doesn't really show that it's a dialog list. CourseType is a hidden field, with a value. Hmmm, can you explain how this is supposed to work? What's the real field??

And yes, sequence matters. If your JavaScript is added at the top, in the HEAD section probably, the line gets evaluated when the page is loaded. If you need the code to be executed elsewhere, you have to include the JavaScript code in your page manually, with passthru HTML enabled. Select the HTML in your page, then click Text/Passthru HTML.
0
 

Author Comment

by:kasperEH
ID: 23719944
All of you, thanks for your trying to help me with this problem. I have now chosen a different solution, where I use Computed Text instead of JavaScript.

I still find it strange that passthru HTML with JavaScript placed at the bottom of the form appears before a hidden field placed at the top of the form, but never mind.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question