Novell Home

Auto-filling iManager Fields

Novell Cool Solutions: Tip
By Wolfgang Schreiber

Digg This - Slashdot This

Posted: 12 Oct 2005
 

Problem

A reader recently asked the following questions about the iManager Plug-in Studio:

"I'm using the iManager 2.5 Plug-in Studio to create a custom plug-in so the help desk can create a user. Is there a way to get values for certain attributes to be auto filled/populated, based on previous selections? For example, if the user selects a context (which in this case is geographic location) I'd like the fields for the home directory, GroupWise post office, etc., to be populated, such as with an 'if context=x, then gwpo=a' basis.

Also, how do I reference the input fields? Is it possible to set other attribute values based upon input fields - i.e., set the GroupWise ID to be the same as CN? And is it possible to perform string manipulation for setting values, so if they enter the First (Given) Name and Surname, it could do a string manipulation to suggest a CN? I'm guessing that to do these things I'll need to edit the exported .jsp file."

And here's the response from Wolfgang Schreiber ...

Solution

You can use Javascript to accomplish this. The code needs to react on the change in the input field #1 (<input type='text' onChange=' ... '), to prefill the input field #2.

The following snippet would generate a CN while entering the Given/Last name:

Before:

<INPUT type='text' name="_Surname" value= ...
            ...
            <INPUT type='text' name="_Given_Name" value= ...

After:

<INPUT type='text' name="_Surname"    onblur="makeCn();" 
value= ...
            ...
            <INPUT type='text' name="_Given_Name"    onblur="makeCn();" 
value= ...

    <script>
        function makeCn()
        {
            var form=document.forms[0];
            sGN = form._Given_Name.value;
            sSN = form._Surname.value;
            form._CN.value = sGN.substr(0,1) + sSN
        }
    </script>

This would generate "JDoe" from "John Doe".


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell