Xpages Partial refresh with HTML ID - xpages

I have an InputText which has a function onChange. This function triggers an HTML component with partial refresh. EveryClass in this DIV works great.
but If refreshID is a XPages Design Element Partial Refresh works fine but CSS class does not. For example. In this examle the div which has class named "card", when i click on it It collapse and expand. When The page loaded first It works great but after partial refresh Collapsing and expanding does not work. I do not want to use full refresh because I have added Loading indicator which works with partial refresh and does not work with full refresh. Is there any way to solve this problem. If anyone has a clue I can share full codes..
Thank You
<xp:div id="Results" styleClass="card">
<div class="card-header bg-transparent header-elements-inline">
<span class="card-title font-weight-semibold">
Find What you are looking for...
</span>
<div class="header-elements">
<div class="list-icons">
<i class="icon-help"></i>
<a class="list-icons-item" data-action="collapse"> </a>
<a class="list-icons-item" data-action="remove"> </a>
</div>
</div>
</div>
<div class="card-body">
<div class="form-group form-group-feedback form-group-feedback-left">
<xp:inputText style="width:100%;" id="CompanyName" value="#{viewScope.CompanyName}" styleClass="form-control border-success-300 border-1"> <xp:this.attrs>
<xp:attr name="placeholder" value="What is it You looking for?">
</xp:attr>
</xp:this.attrs>
<xp:typeAhead mode="full" minChars="2" ignoreCase="true" valueList="#{javascript:getCustomersList();}"> </xp:typeAhead>
<xp:eventHandler event="onchange" submit="true" refreshMode="partial"
refreshId="Results"> <xp:this.action><![CDATA[#{javascript:getSearchResults(viewScope.CompanyName)}]]></xp:this.action>
</xp:eventHandler></xp:inputText>
<div class="form-control-feedback"> <i class="mt-2 icon-reading text-muted"> </i> </div> </div>
<div class="">
<xp:comboBox id="Staff" value="#{viewScope.Staff}" styleClass="form-control"> <xp:this.disabled><![CDATA[#{javascript:viewScope.CompanyName=="" || viewScope.CompanyName==null; }]]></xp:this.disabled>
<xp:selectItems> <xp:this.value><![CDATA[#{javascript:viewScope.Staff}]]></xp:this.value> </xp:selectItems>
<xp:eventHandler event="onchange" submit="true" refreshMode="partial" refreshId="Results"> <xp:this.action><![CDATA[#{javascript:var fName = viewScope.CompanyName;var uName = viewScope.Staff;
getUrunDetails(fName, uName)}]]></xp:this.action> </xp:eventHandler></xp:comboBox></div><div class="">
<xp:label value="Lastest Order Date:" id="label3" styleClass="col-form-label"></xp:label></div> <div class=""><xp:inputText id="LatestOrderDate" value="#{viewScope.LatestOrderDate}" styleClass="text-right form-control border-success-300 border-1" disabled="true">
</xp:inputText> </div> </div>
</xp:div>
UPDATE-2
<div id="view:_id1:_id1766:Results" class="card">
<div class="card-header bg-transparent header-elements-inline"><span class="card-title font-weight-semibold">Ara...</span>
<div class="header-elements"><div class="list-icons"><a class="list-icons-item" href="#"><i class="icon-help"></i></a>
<a class="list-icons-item" data-action="collapse"></a><a class="list-icons-item" data-action="remove"></a></div></div></div>
<div class="card-body"><div class="form-group form-group-feedback form-group-feedback-left">
<span id="view:_id1:_id1766:_id2717" dojotype="ibm.xsp.widget.layout.data.TypeAheadReadStore" jsid="view__id1__id1766__id2717" minchars="2" mode="full"></span>
<div class="dijit dijitReset dijitInline dijitLeft dijitTextBox dijitComboBox dijitValidationTextBox form-control border-success-300 border-1" id="widget_view:_id1:_id1766:FirmaAdi" role="combobox" aria-haspopup="true" data-dojo-attach-point="_popupStateNode" lang="en" widgetid="view:_id1:_id1766:FirmaAdi" style="width: 100%;"><div class="dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer" data-dojo-attach-point="_buttonNode" role="presentation" style="display: none;"><input class="dijitReset dijitInputField dijitArrowButtonInner" value="▼ " type="text" tabindex="-1" readonly="readonly" role="button presentation" aria-hidden="true"></div><div class="dijitReset dijitValidationContainer"><input class="dijitReset dijitInputField dijitValidationIcon dijitValidationInner" value="Χ " type="text" tabindex="-1" readonly="readonly" role="presentation"></div><div class="dijitReset dijitInputField dijitInputContainer"><input class="dijitReset dijitInputInner" name="view:_id1:_id1766:FirmaAdi" type="text" autocomplete="off" data-dojo-attach-point="textbox,focusNode" role="textbox" tabindex="0" id="view:_id1:_id1766:FirmaAdi" value="DÖKTAŞ DÖKÜMCÜLÜK TİC VE SAN. A.Ş." aria-invalid="false"><span class="dijitPlaceHolder dijitInputField" style="display: none;">Ne Aramıştınız?</span></div></div><div class="form-control-feedback"><i class="mt-2 icon-reading text-muted"></i></div></div><div><select id="view:_id1:_id1766:Urun" name="view:_id1:_id1766:Urun" class="form-control" size="1"> <option value="Staff 0</option>
<option value="Staff 1</option>
<option value="Staff 2</option>
<option value="Staff 3</option>
</select></div><div>
<label id="view:_id1:_id1766:label3" class="col-form-label">Son Sipariş:<a id="view:_id1:_id1766:link14" href="http://portal/xspFrmProposal.xsp?action=editDocument&documentId=FD0F115C68C2BD52432586950040A419" class="text-right mr-2 ml-2 r text-primary list-icons-item" target="_blank" data-popup="popover" data-trigger="hover" data-content="DÖKTAŞ DÖKÜMCÜLÜK TİC VE SAN. A.Ş. ye ait Sözleşme Formuna git..." data-original-title="Müşteri Bilgilerine Git" data-placement="bottom"><i class="icon-link2"></i></a></label></div><div><input type="text" value="11.03.2021 15:26:49" id="view:_id1:_id1766:SiparisTarihi" name="view:_id1:_id1766:SiparisTarihi" disabled="disabled" class="text-right form-control border-success-300 border-1"></div><div><label class="col-form-label">Son Teklif:<a id="view:_id1:_id1766:link12" href="http://portal.acarermetal.com.tr/ays/crm.nsf/xspFrmTeklif.xsp?action=editDocument&documentId=38ED7907DE9CFAD943258693003E7D3F" class="text-right mr-2 ml-2 r text-primary list-icons-item" target="_blank" data-popup="popover" data-trigger="hover" data-content="DÖKTAŞ DÖKÜMCÜLÜK TİC VE SAN. A.Ş. ye ait son teklif formuna git..." data-original-title="Müşteri Bilgilerine Git" data-placement="bottom"><i class="icon-link2"></i></a></label></div><div><input type="text" value="09.03.2021" id="view:_id1:_id1766:TeklifTarihi" name="view:_id1:_id1766:TeklifTarihi" disabled="disabled" class="text-right form-control border-success-300 border-1"></div><div><label class="col-form-label">Son Teklif Verilen Malzemeler:</label><textarea name="view:_id1:_id1766:Urunt" data-dojo-attach-point="focusNode,containerNode,textbox" autocomplete="off" class="dijitTextBox dijitTextArea dijitExpandingTextArea form-control elastic elastic-destroy dijitTextBoxDisabled dijitTextAreaDisabled dijitExpandingTextAreaDisabled dijitDisabled" tabindex="-1" lang="en" disabled="" aria-disabled="true" id="view:_id1:_id1766:Urunt" rows="1" widgetid="view:_id1:_id1766:Urunt" value="2 Ton FEMO 16995usd
" style="overflow: auto hidden; box-sizing: border-box; min-height: 72px; height: 68px;"></textarea></div></div></div>

Related

chrome button not click (element not visible) using VBA

im trying to click this specific button but it seems its not working can someone help me?
heres what i wrote
obj.FindElementByXPath("//button[#class='btn btn-warning waves-effect m-1' and #id='btn-create-beneficiary' and text()=' Create Beneficiary']").Click
<div role="tabpanel" class="tab-pane fade in active" id="benef_tab">
<div class="d-flex m-b-15" style="justify-content: flex-end;">
<button class="btn btn-warning waves-effect m-1" id="btn-create-beneficiary" data-toggle="modal" data-target="#createModal" style=""> Create Beneficiary</button>
<button class="btn btn-success waves-effect m-1" data-action="encoding-complete" style="display: none;"><i class="material-icons">done_all</i> Mark as Completed</button>
<button class="btn btn-warning waves-effect m-1" data-action="return-beneficiaries" data-id="15945" style="display: none;"><i class="material-icons">assignment_return</i> Return For Re-check</button>
<button class="btn bg-teal waves-effect m-1" data-action="undo-completeness" style="display: none;"><i class="material-icons">replay</i> Undo</button>
</div>
<div class="table-responsive">
<div id="benefTable_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer"><div class="dt-buttons"><a class="dt-button buttons-excel buttons-html5 btn bg-pink waves-effect" tabindex="0" aria-controls="benefTable" href="#"><span>Excel Download</span></a></div><div id="benefTable_filter" class="dataTables_filter"><label>Filter Result <small class="text-muted">(ID,NAME)</small>:<input type="search" class="form-control input-sm" placeholder="" aria-controls="benefTable"></label></div><div id="benefTable_processing" class="dataTables_processing" style="display: none;"><div style="display: flex; align-items: center;">
<div class="preloader pl-size-xs">
<div class="spinner-layer pl-red-grey">
<div class="circle-clipper left">
<div class="circle"></div>
</div>
<div class="circle-clipper right">
<div class="circle"></div>
</div>
</div>
</div>
VBA
First, set your reference to the Selenium WebDrive in the References tool...
Then the following code:
''*************************************************
Dim MyButton as Selenium.WebElement
Set MyButton = Obj.FindElementByCSS("#btn-create-beneficiary")
MyButton.Click

How to implement one2many field on odoo 15 website form

I have a custom module and i want to create a website form for my module. In the backend form the is a section where user enters service details through a one2many field. The form is to be made available to portal users on the website.How do i implement one2many field on the website so that the information can be recorded in backend??This is my backend form view
This is my website form.I've been able to do first part of form and need help with many2one
<template id="online_request_form">
<t t-call="portal.portal_layout">
<t t-set="breadcrumbs_searchbar" t-value="True"/>
<t t-call="portal.portal_searchbar">
<t t-set="title">Service Request</t>
</t>
<div id="wrap" class="oe_structure oe_empty">
<section class="s_website_form" data-vcss="001" data-snippet="s_website_form">
<div class="container">
<form action="/submit/request" method="post" enctype="multipart/form-data" class="o_mark_required" data-mark="*" data-model_name="" data-success-page="">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<table style="border:0px; width:100%%; background-color:#D6EEEE; margin-top:5%%;">
<group>
<tr>
<td>
<group>
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 50%%" for="studio1">
<span class="s_website_form_label_content">Agency</span>
<span class="s_website_form_mark"> *</span>
</label>
<div class="col-sm">
<select name="agency" t-attf-class="form-control s_website_form_input" required="1">
<option value=""><i>Please Select</i></option>
<t t-foreach="agencies or []" t-as="agency">
<option t-att-value="agency.id">
<t t-esc="agency.name" />
</option>
</t>
</select>
</div>
</group>
<group>
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 50%%" for="studio1">
<span class="s_website_form_label_content">Agent</span>
<span class="s_website_form_mark"> *</span>
</label>
<div class="col-sm">
<select name="agent" t-attf-class="form-control s_website_form_input" required="1">
<option value=""><i>Please Select</i></option>
<t t-foreach="agents or []" t-as="agent">
<option t-att-value="agent.id">
<t t-esc="agent.name" />
</option>
</t>
</select>
</div>
</group>
</td>
<td>
<group>
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 50%%" for="studio1">
<span class="s_website_form_label_content"> IMDG Code / Un No.</span>
<span class="s_website_form_mark"> *</span>
</label>
<div class="col-sm">
<input id="imdg_code" type="text" class="form-control s_website_form_input" name="imdg_code" required="1"/>
</div>
</group>
<group>
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 50%%" for="studio1">
<span class="s_website_form_label_content">Phone</span>
<span class="s_website_form_mark"> *</span>
</label>
<div class="col-sm">
<input id="phone" type="text" class="form-control s_website_form_input" name="phone" required="1"/>
</div>
</group>
</td>
</tr>
</group>
<tr>
<td>
<group>
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 50%%" for="studio1">
<span class="s_website_form_label_content">Email</span>
<span class="s_website_form_mark"> *</span>
</label>
<div class="col-sm">
<input id="email" type="text" class="form-control s_website_form_input" name="email" required="1"/>
</div>
</group>
</td>
</tr>
</table>
<div style="width:200px; margin-top:2%%;" class="form-group col-12 s_website_form_submit" data-name="Submit Button">
<div class="s_website_form_label"/>
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
</div>
</section>
</div>
</t>
</template>
The template for website form.
#http.route('/service_requests', type='http', auth="user", website=True)
def service_request(self):
products = request.env['product.template'].sudo().search([])
agencies = request.env['res.partner'].sudo().search([])
agents = request.env['res.users'].sudo().search([])
values = {}
values.update({
'products': products,
'agencies': agencies,
'agents':agents,
'page_name': 'new_request',
})
return request.render("service_request.online_request_form", values)
Corresponding controller

How can I extract the text from a div tag with style attribute set as "display: none;" through selenium

My html looks like this:
<div class="row">
<div class="col-md-7">
<ul class="breadcrumb">
<li id="get_data">Get data</li>
<li id="sampling_task">Sampling</li>
<li id="confirm_task">Confirmation</li>
</ul>
<div class="container-fluid">
<form action="#" method="post" enctype="multipart/form-data" role="form" class="form-horizontal">
{% csrf_token %}
<div class="form-group">
<label for="id_fileA" class="col-sm-3 control-label" style="text-align: left">
Select dataset A<span class='required_label'>*</span>
</label>
<div class="col-sm-9">
{{ form.fileA|attr:"class:form-control" }}
</div>
</div>
<div class="form-group"></div>
<div class="form-group">
<label for="id_fileB" class="col-sm-3 control-label" style="text-align: left">
Select dataset B<span class='required_label'>*</span>
</label>
<div class="col-sm-9">
{{ form.fileB|attr:"class:form-control" }}
</div>
</div>
<div class="form-group"></div>
<div class="form-group" id="sample_btn" style="display: none">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-9">
<input type="button" name="theButton" id="sample-step" value="Start Sampling" class="btn btn-success btn-large disabled" style="border-radius: 5px;">
</div>
</div>
<div class="form-group">
<div class="col-sm-9 col-sm-offset-3" id="sample_msg" style="display: none;">
<p id="sample_text" style="font-size: medium">
Some ABCD message
</p>
</div>
</div>
<div class="form-group">
<div class="col-sm-9 col-sm-offset-3" id="get_sample_confirm_msg" style="display: none;">
<p>
<input type="button" style="height: 40px; width: 140px; border-radius: 5px" name="YesButton" id="accept-step" value="Accept & Continue" class="btn btn-success disabled">
<input type="button" style="height: 40px; width: 140px; border-radius: 5px" name="NoButton" id="cancel-step" value="Cancel Sampling" class="btn btn-danger disabled">
</p>
</div>
</div>
</form>
</div>
</div>
<div class="col-md-5">
</div>
</div>
The backend is a javascript and on button click, it do processing and if something fails the javascript code update the message.
var error = "<div class='alert alert-danger'><p>We encountered an error while sampling: <br /><strong>Sampling failed!!</strong></p>"; error += "<p>Please <a href='mailto:abcd#gmail.com'>contact us</a> if this error persists.</p>";
error += "</div>";
$('#sample_msg').html(error);
Now, in my selenium code if I do this:
sample_msg = self.driver.find_element_by_id('sample_msg')
I get an empty list result. What I want is to do is read the error in the "sample_msg" class if any and I have tried few things but its not working out. Help is appreciated. Thanks.
If you want to get access to hidden text you might need to use below code:
sample_msg = self.driver.find_element_by_id('sample_msg').get_attribute('textContent').strip()
Note that text property allows to get text from visible elements only
As you are trying to extract the error message Some ABCD message it is contained within a <p> tag which have parent <div> tag with style attribute set as display: none;. So to extract the text you can use the following code block :
element = driver.find_element_by_xpath("//div[#class='form-group']/div[#id='sample_msg']")
driver.execute_script("arguments[0].removeAttribute('style')", element)
print(driver.find_element_by_xpath("//div[#class='form-group']/div[#id='sample_msg']/p").get_attribute("innerHTML"))
So, you have to wait for sometime after clicking the button and once some message appears then you need to extract that message.
Try below:-
WebDriverWait wait = new WebDriverWait(webDriver, timeoutInSeconds);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id));
or
wait.until(ExpectedConditions.elementToBeClickable(By.id));
to be precise.
See also:
org.openqa.selenium.support.ui.ExpectedConditions for similar shortcuts for various wait scenarios.
org.openqa.selenium.support.ui.WebDriverWait for its various constructors.
You can check the python syntax also on the above links.

Date fields and BootStrap Extension Lib

I have a very simple form that I am trying to use BootStrap from the ExtLib with. Everything is fine until I add a field that is of type Date or Time. Any fields after that field are then off in the design. I would like the labels on the left and the fields on the right. As you can see in this example the "von" and "bis" fields are off once the "Datum" field is displayed (yes, I do see that "Jause" and "Mittagessen" are not aligned correctly, I'll see what the problem is there later :) I have tried everything but cannot see my mistake.
Here is what I am getting in Chrome:
And here is the code:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:panel>
<xp:this.data>
<xp:dominoDocument var="document1" formName="fmTermin"></xp:dominoDocument>
</xp:this.data>
<div class="panel panel-default">
<div class="panel-body">
<form class="form-horizontal">
<div class="form-group">
<label class="col-sm-2 control-label">Mitarbeiter_in</label>
<div class="col-sm-10">
<p class="form-control-static">
<xp:text escape="true" id="computedField1">
<xp:this.value><![CDATA[#{javascript:context.getUser().getFullName()}]]></xp:this.value>
</xp:text>
</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Standort</label>
<div class="col-sm-10">
<p class="form-control-static">
<xp:text escape="true" id="computedField2">
<xp:this.value><![CDATA[#{javascript:userName = context.getUser().getFullName();
#DbLookup(#DbName(), "vwMitarbeiterInNachStandort", userName, 2)}]]></xp:this.value>
</xp:text>
</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Kind</label>
<div class="col-sm-10">
<p class="form-control-static">
<xp:comboBox id="comboBox1" value="#{document1.nachname}" style="width:350px">
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:userName = context.getUser().getFullName();
standort = #DbLookup(#DbName(), "vwMitarbeiterInNachStandort", userName, 2);
kinder = #DbLookup(#DbName(), "vwKindNachStandort", standort, 2);
kinder
}]]></xp:this.value>
</xp:selectItems>
</xp:comboBox>
</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Jause</label>
<div class="col-sm-10">
<xp:checkBox text="Jause" id="checkBox1" value="#{document1.Jause}" checkedValue="1" uncheckedValue="0"
defaultChecked="true"
></xp:checkBox>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Mittagessen</label>
<div class="col-sm-10">
<xp:checkBox text="Mittagessen" id="checkBox2" value="#{document1.mittagessen}" checkedValue="1" uncheckedValue="0"
defaultChecked="true">
</xp:checkBox>
</div>
</div>
<div class="form-group">
<xp:label value="Datum" id="label1" for="datum" styleClass="control-label col-sm-2">
</xp:label>
<div class="col-sm-10">
<xp:inputText id="datum" value="#{document1.datum}" defaultValue="#{javascript:#Now()}">
<xp:dateTimeHelper></xp:dateTimeHelper>
<xp:this.converter>
<xp:convertDateTime type="date" dateStyle="short"></xp:convertDateTime>
</xp:this.converter>
</xp:inputText>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Von</label>
<div class="col-sm-10">
<xp:inputText id="von" value="#{document1.von}" defaultValue="#{javascript:#Now()}">
<xp:dateTimeHelper></xp:dateTimeHelper>
<xp:this.converter>
<xp:convertDateTime type="time" timeStyle="short"></xp:convertDateTime>
</xp:this.converter>
</xp:inputText>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Bis</label>
<div class="col-sm-10">
<xp:inputText id="bis" value="#{document1.bis}" defaultValue="#{javascript:#Now()}">
<xp:dateTimeHelper></xp:dateTimeHelper>
<xp:this.converter>
<xp:convertDateTime type="time" timeStyle="short"></xp:convertDateTime>
</xp:this.converter>
</xp:inputText>
</div>
</div>
</form>
</div>
</div>
</xp:panel>
</xp:view>
I've copied your code and tested it with version 11 of the Extension Library and the built-in Bootstrap3.2.0 theme. I've changed the <form class="form-horizontal"> to a <div class="form-horizontal">. After that it looked Ok: Von und Bis were rendered just as the other labels.
A <form> is always created by the XPages engine automatically, so you don't need to add that yourself. The form-horizontal class in Bootstrap isn't restricted for use with a form tag only: it can be used just as well with a <div>.
Mark answered the question but I cannot seem to find the "Mark as Answered" flag in the comment! Here is his answer:
I've copied your code and tested it with v11 of the ExtLib and the built-in Bootstrap3.2.0 theme. I've changed the to a . Adding your own form tags to an XPage isn't a good idea. After that it looked Ok: Von und Bis were rendered just as the other labels

Unable to post from bootstrap modal

In the header of my app, I have a link, clicking on which opens up the bootstrap popup modal. When I insert data in the text boxes and click on Submit, No action is happening. Please advice. Thanks.
Here is my html for the modal:
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Modal title</h4>
</div>
<form action="addCard" method="post" id="addcard" class="form-horizontal" role="form">
<div class="modal-body" style="height: 140px;">
<div class="form-group" style="height: 30px;">
<label for="title" class="col-md-3 control-label">Title</label>
<div class="col-md-9">
<input type="text" class="form-control" name="title" placeholder="Enter Card title here...">
</div>
</div>
<div class="form-group" style="height: 30px;">
<label for="title" class="col-md-3 control-label">Description</label>
<div class="col-md-9">
<input type="text" class="form-control" name="desc" placeholder="Enter Card description here...">
</div>
</div>
<div class="form-group">
<label for="priority" class="col-md-3 control-label">Priority</label>
<div class="col-md-9">
<select name="priority" class="form-control">
<option value="critical">Critical</option>
<option value="high">High</option>
<option value="normal">Normal</option>
<option value="low">Low</option>
</select>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" type="submit">Submit</button>
</div>
</form>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
I have this line in my app.js file:
app.post('/addCard', routes.addCard);
Index.js:
exports.addCard = function (req,res)
{
res.render('index');
}

Resources