Running a ND9 server and when browsing a Xpage with a date field, the default value for this field is always today's date.
On a 8.5.3 server the control is rendered like this:
<input class="dijitReset dijitInputInner" dojoattachpoint="textbox,focusNode" autocomplete="off" type="text" aria-valuenow="undefined" aria-invalid="false" id="view:_id1:_id2:main:fromTDate" tabindex="0" value="">
<input style="display: none;" type="text" name="view:_id1:_id2:main:fromTDate">
On a ND9 server the same control renders like this:
<input class="dijitReset dijitInputInner" type="text" autocomplete="off" data-dojo-attach-point="textbox,focusNode" role="textbox" aria-haspopup="true" aria-invalid="false" tabindex="0" id="view:_id1:_id2:main:fromTDate" maxlength="10" size="10" value="">
<input type="hidden" name="view:_id1:_id2:main:fromTDate" value="2013-03-26">
I've been able to circumvent it by adding a Dojo Date Text Box instead but this feature must be wrong, right?
This was actually a fix put into v9.0. Today's date appearing by default is now the expected behaviour
Add this to your XPage and the behavior is like in 8.5.3
<xp:this.resources>
<xp:script clientSide="true">
<xp:this.contents><![CDATA[
require([
"dojo/_base/lang",
"ibm/xsp/widget/layout/DateTextBox",
"ibm/xsp/widget/layout/TimeTextBox",
"ibm/xsp/widget/layout/DateTimeTextBox"
], function(lang, DateTextBox, TimeTextBox, DateTimeTextBox){
var a = {};
lang.mixin(a, {
postCreate: function(){
this.inherited(arguments);
}
});
DateTextBox.extend(a);
TimeTextBox.extend(a);
DateTimeTextBox.extend(a);
});
]]></xp:this.contents>
</xp:script>
</xp:this.resources>
Thanks IBM for the fast response.
Related
Since I wanted an application that would act more like a search engine, I have used custom search.ai. However, in the production environment, I see queries and subscription keys, I have to enter. I wish to obtain these codes, so could you please explain how I go about getting them.
Your help is greatly appreciated!
You can use :
<form method="GET" action="https://www.bing.com" target="_blank">
Search Bing: <input type="text" name="q" placeholder="Search..."/>
<input type="submit" value="Search"/>
</form>
And if you want to do a custom site search then you can use:
var q = document.getElementById("query");
var val= document.getElementById('hidden').value = "+site:reddit.com";
document.getElementById('search').onclick = function() {
window.location.href='http://bing.com/search?q='+q.value+val;
};
// Submitting value when 'Enter' is pressed
document.addEventListener("keydown", event => {
if (event.isComposing || event.keyCode !== 13) {
return;
}
window.location.href='http://bing.com/search?q='+q.value+val;
});
<input id="query" type="text" name="q" maxlength="255" placeholder="Search in the site" value="">
<input id="hidden" name="q" type="hidden">
<input id="search" name="q" maxlength="255" placeholder="Search in the site" type="button" value="Search">
You can also use this to open images,videos, etc. directly.
I'm starting to use the liferay-auto-fields composant.
So here is my jsp with the aui:script -->
<aui:form action="<%=saveMotiveURL%>" name="fm" method="post" enctype="multipart/form-data" onSubmit="setZones()" >
<aui:fieldset>
<aui:field-wrapper>
<div id="emailAdress-fields">
<label class="control-label"><liferay-ui:message key="motiveConfigEdit.col5"></liferay-ui:message> </label>
<div class="lfr-form-row lfr-form-row-inline">
<div class="row-fields">
<aui:input type="text" name="emailAdress1" fieldParam='emailAdress1' id='emailAdress1' label="" value=""/>
<aui:input type="hidden" name="motiveEmailId1" fieldParam='motiveEmailId1' id='motiveEmailId1' value=""/>
</div>
</div>
</div>
<aui:button type="submit" name="saveButton" value="button.create" label=""/>
</aui:field-wrapper>
</aui:fieldset>
</aui:form>
<aui:script>
AUI().use('liferay-auto-fields',function(A) {
new Liferay.AutoFields(
{
contentBox: '#emailAdress-fields',
fieldIndexes: '<portlet:namespace />rowIndexes'
}
).render();
});
</aui:script>
Then, i want to retrieve the "rowIndexes" in the processaction function, so i do :
String rowIndexes = actionRequest.getParameter("rowIndexes");
And this always gives me EMPTY.
I notice also that the hidden field in the jsp 'rowIndexes' doesn't change or have value when i had an autofield by clicking on the "+" button.
Is anyone has a solution ?
thanks
There are a couple of issues with your code you would like to address,
aui is deprecated and you should avoid when possible
prefer tags like
<liferay-frontend:edit-form>
<liferay-frontend:edit-form-body>
<liferay-frontend:fieldset-group>
<liferay-frontend:fieldset>
The following structure should work on the latest versions of Liferay:
<liferay-frontend:fieldset >
<div id='emailAdress-fields'>
<div class='lfr-form-row lfr-form-row-inline'>
<div class='row-fields'>
</div>
</div>
</div>
</liferay-frontend:fieldset>
Your script seems fine
<aui:script use='aui-base'>
A.use('liferay-auto-fields',function(A) {
new Liferay.AutoFields({
contentBox: '#emailAdress-fields',
fieldIndexes: '<portlet:namespace/>rowIndexes'
}).render();
})
</aui:script>
I am trying to build an app that lets users find other users with a specific combination of skills. I ask the users to select which skills they are looking for via checkboxes but I'm not sure how to request for the status of that checkbox in my function.
My function currently is:
UserInfo.find()
.where('skill1').equals('')
.where('skill2').equals('')
.where('skill3').equals('')
.limit(10)
.then(function(doc) {
res.render('index', {items: doc});
});
It works properly if I set the equals('') to true or false but I'm not sure how to set it dynamically. My HTML code for the checkboxes is:
<form action="/getskills" method="get">
<div class="input">
<label for="skill1">Skill1</label>
<input type="checkbox" id="skill1" name="skill1" value="skill1"/>
</div>
<div class="input">
<label for="skill2">Skill2</label>
<input type="checkbox" id="skill2" name="skill2" value="skill2"/>
</div>
<div class="input">
<label for="skill3">Skill3</label>
<input type="checkbox" id="skill3" name="skill3" value="skill3"/>
</div>
FIND SKILL
</form>
How can I create and integrate a function to check the value of the checkbox and set the value of the required skill to either true or false?
Thanks in advance for your help.
The problem is that you are using an <a> element to perform the request to the server instead of <input type="submit">. Without a submit button, the elements on your form will not be submitted with the request. Modify your html to this
<form action="/getskills" method="get">
<div class="input">
<label for="skill1">Skill1</label>
<input type="checkbox" id="skill1" name="skill1" value="skill1" />
</div>
<div class="input">
<label for="skill2">Skill2</label>
<input type="checkbox" id="skill2" name="skill2" value="skill2" />
</div>
<div class="input">
<label for="skill3">Skill3</label>
<input type="checkbox" id="skill3" name="skill3" value="skill3" />
</div>
<input type="submit" value="FIND SKILL" />
</form>
then in your Node.js code (I assume you are using express), you can get the checkbox values as query parameters as follows:
//I'm assuming the req parameter is passed in to the express get() method
UserInfo.find()
.where('skill1').equals(req.query.skill1)
.where('skill2').equals(req.query.skill2)
.where('skill3').equals(req.query.skill3)
.limit(10)
.then(function(doc) {
res.render('index', {items: doc});
});
I am currently refactoring an application and moving all form elements to one component called Control which will handle things like showing errors for a form control.
I currently have this part class="input" :class="{ 'is-danger' : errors['description'] }" left which is the same for every single component but slots can't be assigned any properties or attributes so what would be the way to solve the below issue and stop repeating that :class over and over?
control.vue
<template>
<p class="control">
<slot class="input" :class="{ 'error' : errors[model] }"></slot>
<template v-if="errors[model]">
<i class="fa fa-check"></i>
<span class="help error">{{ errors[model][0] }}</span>
</template>
</p>
</template>
<script>
export default {
props: {
model: String,
errors: Object,
}
}
</script>
usage - current
<control model="description" :errors="errors">
<input class="input" :class="{ 'is-danger' : errors['description'] }" type="text" v-model="item.description">
</control>
usage - goal
<control model="description" :errors="errors">
<input type="text" v-model="item.description">
</control>
I have this HTML code
<div id="nodate" style="display:none">
<span id="A">
<input type="submit" value="Close" onclick="toggle();" a href=”#”>Text</input>
</span>
There are no dates here. Select another.
</div>
<input type="submit" value="Fri Nov 8th, 2013" onclick="toggle();"></input>
I have an input for the close function which shows a button. But I want to assign this onclick action to an image or text instead of an input button. I have tried many ways but cant seem to get it.
For an image:
<input type="image" src="Image.jpg" onclick="toggle();" />
You could also use:
<button onclick="toggle();"><img src="Image.jpg" /></button>
Note, if you don't want the form to submit when you click on the button, you'd want to have:
<button type="button" onclick="toggle();"><img src="Image.jpg" /></button>
For text, you could just use a hyperlink:
Text
Or:
Text
Using Jquery you can do that
$("#imgclick").click(function (e) {
toggle();
//even better //$("#idtarget").toggle();
});
<img src="..." id="imgclick">