Bristan_Service_Desk
asked on
Accessing CheckboxGroup Values in SSJS (Xpages)
Hi
I'm trying to access the selected values of a checkbox group in SSJS within a button on an Xpage. The button itself is building an email based on various elements of the page. I've tried numerous ways and the nearest I've come so far is:
The code is building part of a table with the checkbox values inside table cells. Now I'm getting the correct amount of values returned (ie I tick 3 boxes in the group and 3 values get returned), however all of the values are 'undefined'.
The checkbox group is bound to a field on a notes document and so gets stored as a text list and I've had no luck trying to get the values via the field either.
I'm sure this is probably something so simple but it's evading me at the moment so any help would be appreciated!
I'm trying to access the selected values of a checkbox group in SSJS within a button on an Xpage. The button itself is building an email based on various elements of the page. I've tried numerous ways and the nearest I've come so far is:
var _temp = getComponent("checkBoxGroup1").getValue();
for (x in _temp)
{
stream.writeText("<td>" + _temp[x] + "</td>");
stream.writeText("</tr><tr><td></td>");
}
The code is building part of a table with the checkbox values inside table cells. Now I'm getting the correct amount of values returned (ie I tick 3 boxes in the group and 3 values get returned), however all of the values are 'undefined'.
The checkbox group is bound to a field on a notes document and so gets stored as a text list and I've had no luck trying to get the values via the field either.
I'm sure this is probably something so simple but it's evading me at the moment so any help would be appreciated!
In SSJS, you'd better use the bound variable or field. Can you share some source code, e.g. a minimal example of an XPage with this problem, so we can paste it in an XPage and test it?
ASKER
This is the button code (slightly cut down):
The for loop in the middle of the code is the key part, I just need it to access the individual selected options from the checkbox group. As I said previously, this half works, I get the correct amount of selected items, but they all say 'undefined' as the value....
<xp:button value="Approve" id="button3">
<xp:eventHandler event="onclick"
submit="true" refreshMode="complete">
<xp:this.action>
<xp:actionGroup>
<xp:changeDocumentMode
mode="edit" var="document1">
</xp:changeDocumentMode>
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:doc1 = database.createDocument();
doc1.appendItemValue("Form","Memo");
body = doc1.createMIMEEntity();
subject = body.createHeader("Subject");
subject.setHeaderVal("Staff Request for " + document1.getItemValueString("JobTitle") + " Has Been Approved");
stream = session.createStream();
stream.writeText(@Name('[CN]',@UserName(0)) + " has approved a staff request. Please see the details below.<br /><br />");
stream.writeText("<table>");
stream.writeText("<tr>");
stream.writeText("<td>Department:</td>");
stream.writeText("<td>" + document1.getItemValueString("Department") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr>");
stream.writeText("<td>Job Title:</td>");
stream.writeText("<td>" + document1.getItemValueString("JobTitle") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr>");
stream.writeText("<td>Type:</td>");
stream.writeText("<td>" + document1.getItemValueString("NewOrRep") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr><td><br /></td><td></td></tr><tr>");
stream.writeText("<td>IT Requirements:</td>");
var _temp = getComponent("checkBoxGroup1").getValue();
for (x in _temp)
{
stream.writeText("<td>" + _temp[x] + "</td>");
stream.writeText("</tr><tr><td></td>");
}
stream.writeText("<td></td></tr>");
stream.writeText("</table><br />");
body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0);
doc1.appendItemValue("SendTo", "helpdesk@bristan.com");
doc1.send();
doc1.recycle();
body.recycle();
subject.recycle();
stream.recycle();
}}]]></xp:this.script>
</xp:executeScript>
<xp:saveDocument
var="document1">
</xp:saveDocument>
<xp:openPage name="/vacancy.xsp"
target="openDocument"
documentId="#{javascript:document1.getDocument().getUniversalID();}">
</xp:openPage>
</xp:actionGroup>
</xp:this.action>
</xp:eventHandler>
</xp:button>
The for loop in the middle of the code is the key part, I just need it to access the individual selected options from the checkbox group. As I said previously, this half works, I get the correct amount of selected items, but they all say 'undefined' as the value....
Try with something like
_temp = document1.getItemValue("cb 1");
where wb1 is the name of the field you bound to checkboxGroup1.
_temp = document1.getItemValue("cb
where wb1 is the name of the field you bound to checkboxGroup1.
ASKER
Tried that, it also gives me 'undefined'. If I save the document after the script runs I get a single undefined, if I save it before I get the correct amount of elements again but all undefined. The field contents in this case are below:
Field Name: ITRequirements
Data Type: Text List
Data Length: 111 bytes
Seq Num: 1
Dup Item ID: 0
Field Flags: SUMMARY
"Windows Account"
"Laptop"
"Monitor"
"Desk Phone"
"IFS User - Replacement"
"Lotus Notes Account"
"Microsoft Office"
Did you bind the field correctly to the field on the XPage ? Pls share some code.
ASKER
Hi
Below is the cusom control code:
Below is the cusom control code:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xp:this.resources>
<xp:styleSheet href="/mf54_reset.css"></xp:styleSheet>
<xp:styleSheet href="/mf54_grid_nosidebar.css"></xp:styleSheet>
<xp:styleSheet href="/mf54_content_nosidebar.css"></xp:styleSheet>
</xp:this.resources>
<!-- CONTAINER FOR ENTIRE PAGE -->
<xp:this.data>
<xp:dominoDocument var="document1" formName="StaffRequest"
computeWithForm="onsave">
</xp:dominoDocument>
</xp:this.data>
<xp:panel styleClass="container">
<!-- PAGE SPECIFIC HEADER -->
<xc:breadcrumbVacancy></xc:breadcrumbVacancy>
<!-- NAVIGATION BAR -->
<xc:navbar_homeonly></xc:navbar_homeonly>
<!-- MAIN SECTION -->
<xp:panel styleClass="main">
<!-- CONTENT -->
<xp:panel styleClass="content">
<!-- CONTENT CELL -->
<!-- ANNOUNCEMENTS BLOCK -->
<xp:panel styleClass="corner-content-1col-top"></xp:panel>
<xp:panel styleClass="content-1col-nobox">
<h1 class="noicon">
<xp:label id="label1" disableTheme="true">
<xp:this.value><![CDATA[#{javascript:"Vacancy"}]]></xp:this.value>
</xp:label>
</h1>
<xp:panel
style="padding-left:20.0px;padding-right:20.0px">
<div id="saveResponse" style="display: none;"></div>
<xp:button id="button2">
<xp:this.value><![CDATA[#{javascript:if (@IsNewDoc()) { return "Cancel"; }
else { return "Close"; }}]]></xp:this.value>
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action>
<xp:openPage name="/home.xsp"></xp:openPage>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button value="Edit" id="button1">
<xp:this.rendered><![CDATA[#{javascript:context.getUser().getRoles().contains("[Admin]")
&& !document1.isEditable()}]]></xp:this.rendered>
<xp:eventHandler event="onclick"
submit="true" refreshMode="complete">
<xp:this.action>
<xp:changeDocumentMode mode="edit"
var="document1">
</xp:changeDocumentMode>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button value="Approve" id="button3">
<xp:this.rendered><![CDATA[#{javascript:document1.getItemValueString("Status") == "Pending GMT"
&& (
context.getUser().getRoles().contains("[Admin]")
|| document1.getItemValueString("Authoriser") == @Name('[CN]',@UserName(0))
)
}]]></xp:this.rendered>
<xp:eventHandler event="onclick"
submit="true" refreshMode="complete">
<xp:this.action>
<xp:actionGroup>
<xp:changeDocumentMode
mode="edit" var="document1">
</xp:changeDocumentMode>
<xp:saveDocument
var="document1">
</xp:saveDocument>
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:if (document1.getItemValueString("NewOrRep") == "Replacement")
{
document1.replaceItemValue("Status", "Approved");
document1.replaceItemValue("DateAuthorised", @Now());
// send email
doc1 = database.createDocument();
doc1.appendItemValue("Form","Memo");
body = doc1.createMIMEEntity();
subject = body.createHeader("Subject");
subject.setHeaderVal("Staff Request for " + document1.getItemValueString("JobTitle") + " Has Been Approved");
stream = session.createStream();
stream.writeText(@Name('[CN]',@UserName(0)) + " has approved your staff request, please see the details below.<br /><br />");
stream.writeText("<table>");
stream.writeText("<tr>");
stream.writeText("<td>Department:</td>");
stream.writeText("<td>" + document1.getItemValueString("Department") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr>");
stream.writeText("<td>Job Title:</td>");
stream.writeText("<td>" + document1.getItemValueString("JobTitle") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr>");
stream.writeText("<td>Type:</td>");
stream.writeText("<td>" + document1.getItemValueString("NewOrRep") + "</td>");
stream.writeText("</tr>");
stream.writeText("</table><br />");
stream.writeText("<a href='http://bristanportal/personnel/xpersonnel.nsf/0/" + document1.getDocument().getUniversalID() + "'>Click here</a> to open the request.");
body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0);
doc1.appendItemValue("SendTo", document1.getItemValueString("DocAuthor"));
// doc1.appendItemValue("CopyTo", document1.getItemValueString("DocAuthor"));
doc1.send();
doc1.recycle();
body.recycle();
subject.recycle();
stream.recycle();
if (document1.getItemValueString("ITReq") == "Yes")
{
doc1 = database.createDocument();
doc1.appendItemValue("Form","Memo");
body = doc1.createMIMEEntity();
subject = body.createHeader("Subject");
subject.setHeaderVal("Staff Request for " + document1.getItemValueString("JobTitle") + " Has Been Approved");
stream = session.createStream();
stream.writeText(@Name('[CN]',@UserName(0)) + " has approved a staff request. Please see the details below.<br /><br />");
stream.writeText("<table>");
stream.writeText("<tr>");
stream.writeText("<td>Department:</td>");
stream.writeText("<td>" + document1.getItemValueString("Department") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr>");
stream.writeText("<td>Job Title:</td>");
stream.writeText("<td>" + document1.getItemValueString("JobTitle") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr>");
stream.writeText("<td>Type:</td>");
stream.writeText("<td>" + document1.getItemValueString("NewOrRep") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr><td><br /></td><td></td></tr><tr>");
stream.writeText("<td>IT Requirements:</td>");
var _temp = document1.getItemValue("ITRequirements");
//getComponent("checkBoxGroup1").getValue();
for (x in _temp)
{
stream.writeText("<td>" + _temp[x] + "</td>");
stream.writeText("</tr><tr><td></td>");
}
stream.writeText("<td></td></tr>");
stream.writeText("</table><br />");
// stream.writeText("<a href='http://bristanportal/personnel/xpersonnel.nsf/0/" + document1.getDocument().getUniversalID() + "'>Click here</a> to open the request.");
body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0);
// doc1.appendItemValue("SendTo", document1.getItemValueString("FinanceAuth"));
doc1.appendItemValue("SendTo", "helpdesk@bristan.com");
doc1.send();
doc1.recycle();
body.recycle();
subject.recycle();
stream.recycle();
}
}
else
{
document1.replaceItemValue("Status", "Pending HR");
// send email
doc1 = database.createDocument();
doc1.appendItemValue("Form","Memo");
body = doc1.createMIMEEntity();
subject = body.createHeader("Subject");
subject.setHeaderVal("Staff Request for " + document1.getItemValueString("JobTitle") + " Requires Your Approval");
stream = session.createStream();
stream.writeText(@Name('[CN]',@UserName(0)) + " has approved a staff request which now required your approval, please see the details below.<br /><br />");
stream.writeText("<table>");
stream.writeText("<tr>");
stream.writeText("<td>Department:</td>");
stream.writeText("<td>" + document1.getItemValueString("Department") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr>");
stream.writeText("<td>Job Title:</td>");
stream.writeText("<td>" + document1.getItemValueString("JobTitle") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr>");
stream.writeText("<td>Type:</td>");
stream.writeText("<td>" + document1.getItemValueString("NewOrRep") + "</td>");
stream.writeText("</tr>");
stream.writeText("</table><br />");
stream.writeText("<a href='http://bristanportal/personnel/xpersonnel.nsf/0/" + document1.getDocument().getUniversalID() + "'>Click here</a> to open the request.");
body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0);
doc1.appendItemValue("SendTo", document1.getItemValueString("HRAuth"));
// doc1.appendItemValue("CopyTo", document1.getItemValueString("DocAuthor"));
doc1.send();
doc1.recycle();
body.recycle();
subject.recycle();
stream.recycle();
}}]]></xp:this.script>
</xp:executeScript>
<xp:saveDocument
var="document1">
</xp:saveDocument>
<xp:openPage name="/vacancy.xsp"
target="openDocument"
documentId="#{javascript:document1.getDocument().getUniversalID();}">
</xp:openPage>
</xp:actionGroup>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button value="Approve" id="button6">
<xp:this.rendered><![CDATA[#{javascript:document1.getItemValueString("Status") == "Pending HR"
&& (
context.getUser().getRoles().contains("[Admin]")
|| document1.getItemValueString("HRAuth") == @Name('[CN]',@UserName(0))
)
}]]></xp:this.rendered>
<xp:eventHandler event="onclick"
submit="true" refreshMode="complete">
<xp:this.action>
<xp:actionGroup>
<xp:changeDocumentMode
mode="edit" var="document1">
</xp:changeDocumentMode>
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript: document1.replaceItemValue("Status", "Pending Finance");
// send email
doc1 = database.createDocument();
doc1.appendItemValue("Form","Memo");
body = doc1.createMIMEEntity();
subject = body.createHeader("Subject");
subject.setHeaderVal("Staff Request for " + document1.getItemValueString("JobTitle") + " Requires Your Approval");
stream = session.createStream();
stream.writeText(@Name('[CN]',@UserName(0)) + " has approved a staff request which now required your approval, please see the details below.<br /><br />");
stream.writeText("<table>");
stream.writeText("<tr>");
stream.writeText("<td>Department:</td>");
stream.writeText("<td>" + document1.getItemValueString("Department") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr>");
stream.writeText("<td>Job Title:</td>");
stream.writeText("<td>" + document1.getItemValueString("JobTitle") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr>");
stream.writeText("<td>Type:</td>");
stream.writeText("<td>" + document1.getItemValueString("NewOrRep") + "</td>");
stream.writeText("</tr>");
stream.writeText("</table><br />");
stream.writeText("<a href='http://bristanportal/personnel/xpersonnel.nsf/0/" + document1.getDocument().getUniversalID() + "'>Click here</a> to open the request.");
body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0);
doc1.appendItemValue("SendTo", document1.getItemValueString("FinanceAuth"));
// doc1.appendItemValue("CopyTo", document1.getItemValueString("DocAuthor"));
doc1.send();
doc1.recycle();
body.recycle();
subject.recycle();
stream.recycle();}]]></xp:this.script>
</xp:executeScript>
<xp:saveDocument
var="document1">
</xp:saveDocument>
<xp:openPage name="/vacancy.xsp"
target="openDocument"
documentId="#{javascript:document1.getDocument().getUniversalID();}">
</xp:openPage>
</xp:actionGroup>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button value="Approve" id="button7">
<xp:this.rendered><![CDATA[#{javascript:document1.getItemValueString("Status") == "Pending Finance"
&& (
context.getUser().getRoles().contains("[Admin]")
|| document1.getItemValueString("FinanceAuth") == @Name('[CN]',@UserName(0))
)
}]]></xp:this.rendered>
<xp:eventHandler event="onclick"
submit="true" refreshMode="complete">
<xp:this.action>
<xp:actionGroup>
<xp:changeDocumentMode
mode="edit" var="document1">
</xp:changeDocumentMode>
<xp:saveDocument var="document1">
</xp:saveDocument><xp:executeScript>
<xp:this.script><![CDATA[#{javascript: document1.replaceItemValue("Status", "Approved");
document1.replaceItemValue("DateAuthorised", @Now());
// send email
doc1 = database.createDocument();
doc1.appendItemValue("Form","Memo");
body = doc1.createMIMEEntity();
subject = body.createHeader("Subject");
subject.setHeaderVal("Staff Request for " + document1.getItemValueString("JobTitle") + " Has Been Approved");
stream = session.createStream();
stream.writeText(@Name('[CN]',@UserName(0)) + " has approved your staff request. Please see the details below.<br /><br />");
stream.writeText("<table>");
stream.writeText("<tr>");
stream.writeText("<td>Department:</td>");
stream.writeText("<td>" + document1.getItemValueString("Department") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr>");
stream.writeText("<td>Job Title:</td>");
stream.writeText("<td>" + document1.getItemValueString("JobTitle") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr>");
stream.writeText("<td>Type:</td>");
stream.writeText("<td>" + document1.getItemValueString("NewOrRep") + "</td>");
stream.writeText("</tr>");
stream.writeText("</table><br />");
stream.writeText("<a href='http://bristanportal/personnel/xpersonnel.nsf/0/" + document1.getDocument().getUniversalID() + "'>Click here</a> to open the request.");
body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0);
// doc1.appendItemValue("SendTo", document1.getItemValueString("FinanceAuth"));
doc1.appendItemValue("SendTo", document1.getItemValueString("DocAuthor"));
doc1.send();
doc1.recycle();
body.recycle();
subject.recycle();
stream.recycle();
if (document1.getItemValueString("ITReq") == "Yes")
{
doc1 = database.createDocument();
doc1.appendItemValue("Form","Memo");
body = doc1.createMIMEEntity();
subject = body.createHeader("Subject");
subject.setHeaderVal("Staff Request for " + document1.getItemValueString("JobTitle") + " Has Been Approved");
stream = session.createStream();
stream.writeText(@Name('[CN]',@UserName(0)) + " has approved a staff request. Please see the details below.<br /><br />");
stream.writeText("<table>");
stream.writeText("<tr>");
stream.writeText("<td>Department:</td>");
stream.writeText("<td>" + document1.getItemValueString("Department") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr>");
stream.writeText("<td>Job Title:</td>");
stream.writeText("<td>" + document1.getItemValueString("JobTitle") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr>");
stream.writeText("<td>Type:</td>");
stream.writeText("<td>" + document1.getItemValueString("NewOrRep") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr><td><br /></td><td></td></tr><tr>");
stream.writeText("<td>IT Requirements:</td>");
var _temp = document1.getItemValueString("ITRequirements");
for (x in _temp)
{
stream.writeText("<td>" + _temp[x] + "</td>");
stream.writeText("</tr><tr><td></td>");
}
stream.writeText("<td></td></tr>");
stream.writeText("</table><br />");
// stream.writeText("<a href='http://bristanportal/personnel/xpersonnel.nsf/0/" + document1.getDocument().getUniversalID() + "'>Click here</a> to open the request.");
body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0);
// doc1.appendItemValue("SendTo", document1.getItemValueString("FinanceAuth"));
doc1.appendItemValue("SendTo", "helpdesk@bristan.com");
doc1.send();
doc1.recycle();
body.recycle();
subject.recycle();
stream.recycle();
}}]]></xp:this.script>
</xp:executeScript>
<xp:saveDocument
var="document1">
</xp:saveDocument>
<xp:openPage name="/vacancy.xsp"
target="openDocument"
documentId="#{javascript:document1.getDocument().getUniversalID();}">
</xp:openPage>
</xp:actionGroup>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:tabbedPanel id="tabbedPanel1">
<xp:tabPanel id="tabPanel1">
<xp:this.label><![CDATA[#{javascript:document1.getItemValueString("Status")}]]></xp:this.label>
<xp:panel
style="background-color:rgb(252,95,99);border-color:rgb(0,0,0);border-style:solid;border-width:thin;padding-left:10.0px;height:27px">
<xp:this.rendered><![CDATA[#{javascript:requestScope.errorStatus != "" && requestScope.errorStatus != null }]]></xp:this.rendered>
<xp:image url="/Delete.png"
id="image2" style="margin: 1 0 0 0;">
</xp:image>
<xp:text escape="true"
id="computedField1"
style="font-family:Calibri,sans-serif;font-size:16pt;font-weight:bold"
value="#{javascript:requestScope.errorStatus}">
</xp:text>
</xp:panel>
<xp:table style="width:97%"
disableTheme="true">
<xp:tr>
<xp:td style="width:150px">
<xp:label
value="Department:" id="label10"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td style="width:300.0px"
colspan="3">
<xp:comboBox id="comboBox1"
value="#{document1.Department}"
style="font-family:Calibri,sans-serif;font-size:11pt">
<xp:selectItems
id="selectItems1">
<xp:this.value><![CDATA[#{javascript:@Unique(@DbColumn(@DbName(),"(departments)",1))}]]></xp:this.value>
</xp:selectItems>
<xp:eventHandler
event="onchange" submit="true" refreshMode="partial"
refreshId="comboBox5" id="eventHandler1">
</xp:eventHandler>
</xp:comboBox>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="width:150px">
<xp:label value="Job Role:"
id="label25"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td style="width:300px"
colspan="3">
<xp:comboBox id="comboBox5"
value="#{document1.JobTitle}"
style="font-family:Calibri,sans-serif;font-size:11pt">
<xp:selectItems
id="selectItems2">
<xp:this.value><![CDATA[#{javascript:var keyvar:String;
var combo1 = getComponent("comboBox1").getSubmittedValue();
var combo2 = getComponent("comboBox1").getValue();
if(combo1 === null){keyvar = combo2} else {keyvar = combo1};
@DbLookup(@DbName(),"(DepartmentsByCat)",keyvar,2);}]]></xp:this.value>
</xp:selectItems>
<xp:eventHandler event="onchange" submit="true" refreshMode="complete">
<xp:this.action>
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:var _view:NotesView = database.getView("(DepartmentsByCat2)");
var _result = @DbLookup(database,_view,document1.getItemValueString("Department").concat("-").concat(document1.getItemValueString("JobTitle")),2);
document1.replaceItemValue("CareerLadder",_result);
_result = @DbLookup(database,_view,document1.getItemValueString("Department").concat("-").concat(document1.getItemValueString("JobTitle")),3);
document1.replaceItemValue("CareerLadderGrade",_result);
_view.recycle();}]]></xp:this.script>
</xp:executeScript>
</xp:this.action></xp:eventHandler>
<xp:eventHandler
event="onblur" submit="true" refreshMode="complete">
<xp:this.action>
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:var _view:NotesView = database.getView("(DepartmentsByCat2)");
var _result = @DbLookup(database,_view,document1.getItemValueString("Department").concat("-").concat(document1.getItemValueString("JobTitle")),2);
if (_result != null) {
document1.replaceItemValue("CareerLadder",_result);
}
_result = @DbLookup(database,_view,document1.getItemValueString("Department").concat("-").concat(document1.getItemValueString("JobTitle")),3);
if (_result != null) {
document1.replaceItemValue("CareerLadderGrade",_result);
}
_view.recycle();}]]></xp:this.script>
</xp:executeScript>
</xp:this.action></xp:eventHandler></xp:comboBox>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:label
value="Career Ladder:" id="label2"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td>
<xp:inputText id="inputText4" value="#{document1.CareerLadder}" style="font-family:Calibri,sans-serif;font-size:11pt"></xp:inputText></xp:td>
<xp:td>
<xp:label
value="Career Ladder Grade:" id="label6"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td>
<xp:inputText id="inputText5" value="#{document1.CareerLadderGrade}" style="font-family:Calibri,sans-serif;font-size:11pt"></xp:inputText></xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:label value="Type:"
id="label7"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td>
<xp:comboBox id="comboBox2"
value="#{document1.Type}" style="font-family:Calibri,sans-serif;font-size:11pt">
<xp:selectItem
itemLabel="Full Time" itemValue="Full Time"
id="selectItem1">
</xp:selectItem>
<xp:selectItem
itemLabel="Part Time" itemValue="Part Time"
id="selectItem34">
</xp:selectItem>
</xp:comboBox>
</xp:td>
<xp:td>
<xp:label value="Salary:"
id="label27"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td>
<xp:inputText
id="inputText52" value="#{document1.Salary}" style="font-family:Calibri,sans-serif;font-size:11pt">
<xp:this.converter>
<xp:convertNumber
type="currency" currencySymbol="£">
</xp:convertNumber>
</xp:this.converter>
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:label
value="Contract Type:" id="label8"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td>
<xp:comboBox id="comboBox6"
value="#{document1.ContractType}" style="font-family:Calibri,sans-serif;font-size:11pt">
<xp:selectItem
itemLabel="Permanent" itemValue="Permanent"
id="selectItem35">
</xp:selectItem>
<xp:selectItem
itemLabel="Fixed Term" itemValue="Fixed Term"
id="selectItem36">
</xp:selectItem>
</xp:comboBox>
</xp:td>
<xp:td>
<xp:label
value="Fixed Term End Date:" id="label26"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td>
<xp:inputText
id="inputText48" value="#{document1.FixedTermEndDate}"
style="width:140px;font-family:Calibri,sans-serif;font-size:11pt">
<xp:this.converter>
<xp:convertDateTime
type="date" dateStyle="short">
</xp:convertDateTime>
</xp:this.converter>
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:label value="New Role?:"
id="label3"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td>
<xp:comboBox id="comboBox7"
value="#{document1.NewOrRep}" style="font-family:Calibri,sans-serif;font-size:11pt">
<xp:selectItem
itemLabel="New Position" itemValue="New Position"
id="selectItem37">
</xp:selectItem>
<xp:selectItem
itemLabel="Replacement" itemValue="Replacement"
id="selectItem38">
</xp:selectItem>
</xp:comboBox>
</xp:td>
<xp:td>
<xp:label value="Replacing:"
id="label9"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td>
<xp:comboBox id="comboBox8"
value="#{document1.Replacing}" style="font-family:Calibri,sans-serif;font-size:11pt">
<xp:selectItems
id="selectItems6">
<xp:this.value><![CDATA[#{javascript:""}]]></xp:this.value>
</xp:selectItems>
<xp:selectItems
id="selectItems3">
<xp:this.value><![CDATA[#{javascript:@Unique(@DbColumn(@DbName(),"PublicByNameAll",1))}]]></xp:this.value>
</xp:selectItems>
</xp:comboBox>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:label
value="Line Manager:" id="label11"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td>
<xp:comboBox id="comboBox9"
value="#{document1.LineManager}" style="font-family:Calibri,sans-serif;font-size:11pt">
<xp:selectItems
id="selectItems4">
<xp:this.value><![CDATA[#{javascript:@Unique(@DbColumn(@DbName(),"LineManagers",1))}]]></xp:this.value>
</xp:selectItems>
</xp:comboBox>
</xp:td>
<xp:td>
<xp:label
value="Is Role Budgeted?:" id="label14"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td>
<xp:radioGroup
id="radioGroup9" defaultValue="No"
value="#{document1.Budgeted}">
<xp:selectItem
itemLabel="Yes" itemValue="Yes" id="selectItem39">
</xp:selectItem>
<xp:selectItem
itemLabel="No" itemValue="No" id="selectItem40">
</xp:selectItem>
</xp:radioGroup>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td><xp:label value="People Manager:" id="label12" style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label></xp:td>
<xp:td>
<xp:radioGroup
id="radioGroup1" defaultValue="No"
value="#{document1.PeopleManager}">
<xp:selectItem
itemLabel="Yes" itemValue="Yes" id="selectItem5">
</xp:selectItem>
<xp:selectItem
itemLabel="No" itemValue="No" id="selectItem6">
</xp:selectItem>
</xp:radioGroup></xp:td>
<xp:td><xp:label value="GMT:" id="label13" style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label></xp:td>
<xp:td>
<xp:radioGroup
id="radioGroup2" defaultValue="No"
value="#{document1.GMT}">
<xp:selectItem
itemLabel="Yes" itemValue="Yes" id="selectItem7">
</xp:selectItem>
<xp:selectItem
itemLabel="No" itemValue="No" id="selectItem8">
</xp:selectItem>
</xp:radioGroup></xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:br id="br3"></xp:br>
</xp:td>
<xp:td></xp:td>
<xp:td></xp:td>
<xp:td></xp:td>
</xp:tr>
<xp:tr>
<xp:td valign="top">
<xp:label
value="IT Requirements:" id="label28"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td valign="top">
<xp:radioGroup
id="radioGroup10" defaultValue="No"
value="#{document1.ITReq}">
<xp:selectItem
itemLabel="Yes" itemValue="Yes" id="selectItem42">
</xp:selectItem>
<xp:selectItem
itemLabel="No" itemValue="No" id="selectItem43">
</xp:selectItem>
</xp:radioGroup>
</xp:td>
<xp:td>
<xp:checkBoxGroup
id="checkBoxGroup1" layout="pageDirection"
value="#{document1.ITRequirements}">
<xp:selectItem
itemLabel="Windows Account" itemValue="Windows Account"
id="selectItem41">
</xp:selectItem>
<xp:selectItem
itemLabel="Laptop" itemValue="Laptop" id="selectItem44">
</xp:selectItem>
<xp:selectItem
itemLabel="Desktop PC" itemValue="Desktop PC"
id="selectItem45">
</xp:selectItem>
<xp:selectItem
itemLabel="Igel" itemValue="Igel" id="selectItem46">
</xp:selectItem>
<xp:selectItem
itemLabel="Monitor" itemValue="Monitor"
id="selectItem47">
</xp:selectItem>
<xp:selectItem
itemLabel="Printer" itemValue="Printer"
id="selectItem48">
</xp:selectItem>
<xp:selectItem
itemLabel="Desk Phone" itemValue="Desk Phone"
id="selectItem49">
</xp:selectItem>
<xp:selectItem
itemLabel="IFS User - New License"
itemValue="IFS User - New License" id="selectItem50">
</xp:selectItem>
<xp:selectItem
itemLabel="IFS User - Replacement"
itemValue="IFS User - Replacement" id="selectItem51">
</xp:selectItem>
<xp:selectItem
itemLabel="Lotus Notes Account"
itemValue="Lotus Notes Account" id="selectItem52">
</xp:selectItem>
<xp:selectItem
itemLabel="Microsoft Office" itemValue="Microsoft Office"
id="selectItem53">
</xp:selectItem>
<xp:selectItem
itemLabel="Microsoft Access" itemValue="Microsoft Access"
id="selectItem54">
</xp:selectItem>
<xp:selectItem
itemLabel="Microsoft Visio" itemValue="Microsoft Visio"
id="selectItem55">
</xp:selectItem>
</xp:checkBoxGroup>
</xp:td>
<xp:td>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:br id="br5"></xp:br>
</xp:td>
<xp:td></xp:td>
<xp:td></xp:td>
<xp:td></xp:td>
</xp:tr>
<xp:tr>
<xp:td valign="top">
<xp:label
value="Company Car:" id="label29"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td>
<xp:comboBox id="comboBox10"
value="#{document1.Car}" style="font-family:Calibri,sans-serif;font-size:11pt">
<xp:selectItem
itemLabel="N/A" itemValue="N/A" id="selectItem2">
</xp:selectItem>
<xp:selectItem
itemLabel="Car Allowance" itemValue="Car Allowance"
id="selectItem3">
</xp:selectItem>
<xp:selectItem
itemLabel="Company Car" itemValue="Company Car"
id="selectItem4">
</xp:selectItem>
</xp:comboBox>
</xp:td>
<xp:td valign="top">
<xp:label
value="Annual Car Allowance:" id="label30"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td valign="top">
<xp:inputText
id="inputText1" value="#{document1.Allowance}" style="font-family:Calibri,sans-serif;font-size:11pt">
<xp:this.converter>
<xp:convertNumber
type="number">
</xp:convertNumber>
</xp:this.converter>
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:br id="br6"></xp:br>
</xp:td>
<xp:td></xp:td>
<xp:td></xp:td>
<xp:td></xp:td>
</xp:tr>
<xp:tr>
<xp:td valign="top">
<xp:label
value="Justification for Role:" id="label31"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td colspan="3">
<xp:inputRichText
id="inputRichText2" style="width:475px"
value="#{document1.Justification}">
</xp:inputRichText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
</xp:td>
<xp:td></xp:td>
<xp:td></xp:td>
<xp:td></xp:td>
</xp:tr>
<xp:tr>
<xp:td colspan="4">
<xp:panel
rendered="#{javascript:document1.isEditable()}"
style="width:95%">
<xp:br id="br2"></xp:br>
<xp:label
value="Attach Files:" id="label65"
style="font-weight:bold;text-decoration:underline;font-family:Calibri,sans-serif;font-size:11pt">
</xp:label>
<xp:br id="br4"></xp:br>
<xp:fileUpload
id="fileUpload1" value="#{document1.Files}"
style="width:70%">
</xp:fileUpload>
<xp:br></xp:br></xp:panel>
<xp:panel style="width:95%"
rendered="#{javascript:!document1.isEditable()}">
<xp:br id="br10"></xp:br>
<xp:label
value="Attached Files:" id="label66"
style="font-weight:bold;text-decoration:underline;font-family:Calibri,sans-serif;font-size:11pt">
</xp:label>
<xp:br id="br11"></xp:br>
<xp:fileDownload
rows="30" id="fileDownload1" displayLastModified="false"
value="#{document1.Files}" hideWhen="true"
style="width:100%;font-size:8pt">
<xp:this.allowDelete><![CDATA[${javascript:context.getUser().getRoles().contains('[Admin]');}]]></xp:this.allowDelete>
</xp:fileDownload>
<xp:br></xp:br></xp:panel>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:br></xp:br></xp:td>
<xp:td></xp:td>
<xp:td></xp:td>
<xp:td></xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:label
value="Authoriser:" id="label32"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td>
<xp:comboBox id="comboBox11"
value="#{document1.Authoriser}" style="font-family:Calibri,sans-serif;font-size:11pt">
<xp:selectItems
id="selectItems5">
<xp:this.value><![CDATA[#{javascript:@Unique(@DbColumn(@DbName(),"GMT",1))}]]></xp:this.value>
</xp:selectItems>
</xp:comboBox>
</xp:td>
<xp:td><xp:label value="Reference:" id="label5" style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label></xp:td>
<xp:td><xp:inputText id="inputText3" value="#{document1.FullRef}" readonly="true" style="font-family:Calibri,sans-serif;font-size:11pt">
</xp:inputText></xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:label
value="Created By:" id="label4"
style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label>
</xp:td>
<xp:td>
<xp:inputText
id="inputText2" value="#{document1.DocAuthor}"
readonly="true" style="font-family:Calibri,sans-serif;font-size:11pt">
<xp:this.defaultValue><![CDATA[#{javascript:@Name('[CN]',@UserName(0))}]]></xp:this.defaultValue>
</xp:inputText>
</xp:td>
<xp:td></xp:td>
<xp:td></xp:td>
</xp:tr>
<xp:tr>
<xp:td>
</xp:td>
<xp:td>
</xp:td>
<xp:td></xp:td>
<xp:td></xp:td>
</xp:tr>
<xp:tr>
<xp:td></xp:td>
<xp:td>
<xp:button value="Validate"
id="button5">
<xp:this.rendered><![CDATA[#{javascript:document1.isEditable() && @IsNewDoc()}]]></xp:this.rendered>
<xp:eventHandler
event="onclick" submit="true" refreshMode="complete"
id="eventHandler2">
<xp:this.action>
<xp:actionGroup>
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:requestScope.errorStatus = "";
if (document1.getItemValueString("JobTitle") == "") {
requestScope.errorStatus = "Please select a Job Title.";
return false;
}
if (!document1.getItemValueDouble("Salary") > 0) {
requestScope.errorStatus = "Please enter a Salary.";
return false;
}
if (document1.getItemValueString("ContractType") == "Fixed Term" && document1.getItemValueDate("FixedTermEndDate") == null) {
requestScope.errorStatus = "Please enter a Fixed Term End Date.";
return false;
}
if (document1.getItemValueString("NewOrRep") == "Replacement" && document1.getItemValueString("Replacing") == "") {
requestScope.errorStatus = "Please select who this Staff Request is replacing.";
return false;
}
if (document1.getItemValueString("Car") == "Car Allowance" && !document1.getItemValueDouble("Allowance") > 0) {
requestScope.errorStatus = "Please enter an Annual Car Allowance.";
return false;
}
if (getComponent("inputRichText2").getValue() == "") {
requestScope.errorStatus = "Please enter a Justification.";
return false;
}
viewScope.validRequest = "true";}]]></xp:this.script>
</xp:executeScript>
</xp:actionGroup>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:br id="br1"></xp:br>
<xp:button value="Submit"
id="button4">
<xp:this.rendered><![CDATA[#{javascript:document1.isEditable() && @IsNewDoc() && viewScope.validRequest == "true"}]]></xp:this.rendered>
<xp:eventHandler
event="onclick" submit="true" refreshMode="complete"
id="eventHandler3">
<xp:this.action>
<xp:actionGroup>
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:var _view:NotesView = database.getView("StaffRequestLookup");
var _doc:NotesDocument = _view.getFirstDocument();
if (_doc == null)
{
document1.replaceItemValue("Ref", 1);
}
else
{
document1.replaceItemValue("Ref",_doc.getItemValueDouble("Ref")+1);
}
document1.replaceItemValue("Status", "Pending GMT");
// send email
doc1 = database.createDocument();
doc1.appendItemValue("Form","Memo");
body = doc1.createMIMEEntity();
subject = body.createHeader("Subject");
subject.setHeaderVal("Staff Request for " + document1.getItemValueString("JobTitle") + " Requires Your Authorisation");
stream = session.createStream();
stream.writeText(@Name('[CN]',@UserName(0)) + " has submitted a staff request, please see the details below.<br /><br />");
stream.writeText("<table>");
stream.writeText("<tr>");
stream.writeText("<td>Department:</td>");
stream.writeText("<td>" + document1.getItemValueString("Department") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr>");
stream.writeText("<td>JobTitle:</td>");
stream.writeText("<td>" + document1.getItemValueString("JobTitle") + "</td>");
stream.writeText("</tr>");
stream.writeText("<tr>");
stream.writeText("<td>Type:</td>");
stream.writeText("<td>" + document1.getItemValueString("NewOrRep") + "</td>");
stream.writeText("</tr>");
stream.writeText("</table><br />");
stream.writeText("<a href='http://bristanportal/personnel/xpersonnel.nsf/0/" + document1.getDocument().getUniversalID() + "'>Click here</a> to open the request.");
body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0);
doc1.appendItemValue("SendTo", document1.getItemValueString("Authoriser"));
doc1.send();
doc1.recycle();
body.recycle();
subject.recycle();
stream.recycle();}]]></xp:this.script>
</xp:executeScript>
<xp:saveDocument
var="document1">
</xp:saveDocument>
<xp:openPage
name="/vacancy.xsp" target="openDocument"
documentId="#{javascript:document1.getDocument().getUniversalID();}">
</xp:openPage>
</xp:actionGroup>
</xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:td>
<xp:td></xp:td>
<xp:td></xp:td>
</xp:tr>
</xp:table>
<xp:br></xp:br>
<xp:panel><xp:this.rendered><![CDATA[#{javascript:document1.getItemValueString("Status") == "Approved"}]]></xp:this.rendered>
<xp:table style="width:95.0%">
<xp:tr>
<xp:td style="width:200px"><xp:label value="Date Authorised:" id="label15" style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label></xp:td>
<xp:td>
<xp:inputText
id="inputText6" value="#{document1.DateAuthorised}" readonly="true">
<xp:this.converter><xp:convertDateTime type="date" dateStyle="short"></xp:convertDateTime></xp:this.converter></xp:inputText></xp:td>
</xp:tr>
<xp:tr>
<xp:td><xp:label value="Date Advertised:" id="label16" style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label></xp:td>
<xp:td>
<xp:inputText
id="inputText7" value="#{document1.DateAdvertised}">
<xp:this.converter>
<xp:convertDateTime
type="date" dateStyle="short">
</xp:convertDateTime>
</xp:this.converter>
<xp:dateTimeHelper></xp:dateTimeHelper>
</xp:inputText></xp:td>
</xp:tr>
<xp:tr>
<xp:td><xp:label value="Method of Advertisement:" id="label17" style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label></xp:td>
<xp:td>
<xp:inputText
id="inputText8" value="#{document1.AdvertisementMethod}"
style="width:90%">
</xp:inputText></xp:td>
</xp:tr>
<xp:tr>
<xp:td><xp:label value="Date Filled:" id="label18" style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label></xp:td>
<xp:td></xp:td>
</xp:tr>
<xp:tr>
<xp:td><xp:label value="Method of Filling Role:" id="label19" style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">
</xp:label></xp:td>
<xp:td>
<xp:inputText
id="inputText9" style="width:90%" value="#{document1.MethodFilled}">
</xp:inputText></xp:td>
</xp:tr>
</xp:table></xp:panel>
<xp:br></xp:br>
<xp:table style="width:95.0%"
disableTheme="true">
<xp:tr>
<xp:td>
<xp:inputText
id="inputText16" rendered="false"
value="#{document1.Status}">
<xp:this.defaultValue><![CDATA[#{javascript:"New"}]]></xp:this.defaultValue></xp:inputText>
</xp:td>
<xp:td>
</xp:td>
<xp:td>
</xp:td>
<xp:td>
</xp:td>
</xp:tr>
</xp:table>
</xp:tabPanel>
</xp:tabbedPanel>
</xp:panel>
</xp:panel>
<xp:panel styleClass="corner-content-1col-bottom"></xp:panel>
</xp:panel>
</xp:panel>
<!-- FOOTER -->
<xc:footer></xc:footer>
</xp:panel>
</xp:view>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Sjef,
In answer to your questions, it's mostly just left over code from other things I was trying, but didn't affect anything so I left it for the time being.
As for your suggestion, that worked perfectly!
In answer to your questions, it's mostly just left over code from other things I was trying, but didn't affect anything so I left it for the time being.
As for your suggestion, that worked perfectly!
Ah, I think I remember how it can be done differently, but I'm not quite sure. It's the difference between an Array and a Vector that's bugging us.
Hopefully shorter but equivalent code:
var _temp = document1.getItemValue("IT Requiremen ts");
for (var x in _temp) {
stream.writeText("<td>" + x + "</td>");
stream.writeText("</tr><tr ><td></td> ");
}
What I assume is that the Iterator for an array is/needs an integer, whereas the Iterator for a Vector is one Vector element. Please correct me if I didn't get the names right, but I hope you get my drift.
Hopefully shorter but equivalent code:
var _temp = document1.getItemValue("IT
for (var x in _temp) {
stream.writeText("<td>" + x + "</td>");
stream.writeText("</tr><tr
}
What I assume is that the Iterator for an array is/needs an integer, whereas the Iterator for a Vector is one Vector element. Please correct me if I didn't get the names right, but I hope you get my drift.