How to drop/hide the "No file chosen" text next to the fileUpload button?
Code for my fileUpload control:
<xp:fileUpload id="fileUpload1"
value="#{document1.Picture}"
rendered="#{javascript:document1.isEditable()}"
mimetype="image/jpeg" useUploadname="true"
accept="image/jpeg,image/gif,image/png">
<xp:eventHandler event="onchange"
submit="true" refreshMode="complete"
disableValidators="true">
</xp:eventHandler>
</xp:fileUpload>
Only works in Chrome: Simply set width of file upload Control to 40% automatically "No File Choosen" text will gets disappear
Use this answer which basically creates a styled span that hides the underlying input file button: https://stackoverflow.com/a/9164004/785061
Related
On my XPages form I have a checkbox control:
<xp:checkBox
id="cbPromo"
value="#{employeeBean.employee.promoCheck}"
valueChangeListener="#{employeeBean.onPromotChange}"
checkedValue="true"
uncheckedValue="false"
disabled="#{!employeeBean.employee.editable}">
<xp:eventHandler
event="onclick"
submit="true"
refreshMode="partial"
refreshId="pnlUpdate"
execMode="partial" />
</xp:checkBox>
</xp:panel>
The problem is when I change the edit mode for the employee object (default is editable = false) the checkbox control which was in read mode checked becomes unchecked.
When I add a computed text control to see what the value for the promoCheck field its is both in read and edit mode true:
<xp:text escape="true" id="computedField1"
value="#{employeeBean.employee.promoCheck}">
</xp:text>
Can someone explain me what I should do to keep the checkbox control checked when I switch the editable mode for my employee object?
don't use the disabled property, but the readonly property instead
I have a radio button group, if the user selects an option, the relevant combo box will appear. The user is able to type word or just click the triangle box to search the value.
<xp:table id="InfoTable" style="margin-left:100.0px">
<xp:tr>
<xp:td>
<xp:radioGroup id="radioGroup1" layout="pageDirection">
<xp:selectItem itemLabel="Number"></xp:selectItem>
<xp:selectItem itemLabel="Alphabet"></xp:selectItem>
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="InfoTable">
</xp:eventHandler>
</xp:radioGroup>
</xp:td>
<xp:td>
<xp:comboBox id="comboBox1_destRank"
dojoType="dijit.form.ComboBox" value="# {sessionScope.NumberValue}"
style="width:100.0px">
<xp:this.rendered><![CDATA[#{javascript:var x = getComponent("radioGroup1").getValue();
if(x == "Number")
{ return true; }
if(x == "Alphabet")
{ return false; }}]]></xp:this.rendered>
<xp:selectItem itemLabel="1"></xp:selectItem>
<xp:selectItem itemLabel="2"></xp:selectItem>
<xp:selectItem itemLabel="3"></xp:selectItem>
<xp:selectItem itemLabel="4"></xp:selectItem>
<xp:selectItem itemLabel="5"></xp:selectItem>
</xp:comboBox>
<xp:br></xp:br>
<xp:comboBox id="comboBox2_destPost"
dojoType="dijit.form.ComboBox"
value="#{sessionScope.AlphabetValue}" style="width:100.0px">
<xp:this.rendered><![CDATA[#{javascript:var x = getComponent("radioGroup1").getValue();
if(x == "Alphabet")
{ return true; }
if(x == "Number")
{ return false; }}]]></xp:this.rendered>
<xp:selectItem itemLabel="a"></xp:selectItem>
<xp:selectItem itemLabel="b"></xp:selectItem>
<xp:selectItem itemLabel="c"></xp:selectItem>
<xp:selectItem itemLabel="d"></xp:selectItem>
<xp:selectItem itemLabel="e"></xp:selectItem>
</xp:comboBox>
</xp:td>
</xp:tr>
</xp:table>
I test the code and it works properly. Once I click the radio button, the relevant combo box can display.
However, when my colleagues test it, they tell me they usually have to click the radio button three or four times to show the combo box. I feel strange so I go to see how they click the button, and it is true that one colleague needs to click three times to show the combo box no matter what option he chooses and the other colleague click six times to show.
Later, we use the same computer and same pace to click the mouse to test again, I can display the combo box by click the radio button one time, but my colleagues still needs two and three times to show the combo box.
I examine the code and I don't know which part cause the strange result.
Would someone give advice please. Thank you.
References:
xpages combobox control where user can enter values not in list
Help Contents in Domino Designer
XPages get Value selected from combo box
Where are they clicking? And which version of Domino are you using? I believe clicking the label did not trigger selecting the value in previous versions. It works fine for me with 9.0.1 FP3 in Internet Explorer and Firefox. It may be this issue referred to by Berndt Hort, but the IBM link doesn't work any more and the issue seems to have been fixed in later versions of Domino.
What is the browser that your colleague is using?
onclick event for radio group does not work properly in other browsers. It works fine in IE.
So we did small tweak in the eventHandler code. Please note the reder property of event as follows:
<xp:eventHandler
event="onchange"
submit="true"
refreshMode="partial"
refreshId="pnlMainTTSHF"
disableValidators="true"
id="eventHandler1"
rendered="#{javascript:!context.getUserAgent().isIE()}" />
<xp:eventHandler
event="onclick"
submit="true"
refreshMode="partial"
refreshId="pnlMainTTSHF"
disableValidators="true"
id="eventHandler2"
rendered="#{javascript:context.getUserAgent().isIE()}" />
I have a document that was created using a copyallitems. That document has 2 body fields, and they both have the issummary flag to false.
As soon as I do a document1.save(), both rich text fields now have the flag set to true.
Any idea why the flag would be set to true by saving the document? These fields are not used in any views. I thought that rich text fields were not suppose get the summary flagged when saved.
Both rich text fields are set to store content as MIME...
Any clues on how to avoid the flag from being set, or how to remove the flag before saving (or after, or whatever) the document?
Running on Domino Release 9.0.1FP3 HF241
Here is sample code that recreates the problem, when adding more than 32Kb od text in the rich text field:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"><xp:span style="font-weight:bold"></xp:span>
<xp:label id="label1" styleClass="h1" value="Test Issummary"></xp:label>
<xp:span style="font-weight:bold"></xp:span>
<xp:this.data>
<xp:dominoDocument computeWithForm="onsave" formName="fPage" var="document1"/>
</xp:this.data>
<xp:br></xp:br>
<xp:br></xp:br>
Subject:
<xp:inputText id="inputText1" value="#{document1.Subject}"
style="width:569.0px">
</xp:inputText>
<xp:br></xp:br>Status:
<xp:inputText id="inputText2" defaultValue="Draft" value="#{document1.Status}"></xp:inputText>
<xp:br></xp:br>
<xp:br></xp:br>Body:<xp:br></xp:br>
<xp:inputRichText id="inputRichText1" style="width:100%"
value="#{document1.Body}" htmlConversionWarning="noWarning"
htmlFilter="identity" htmlFilterIn="identity">
</xp:inputRichText>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:button value="Save" id="button1"
style="width:122.0px;height:29.0px">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action>
<xp:actionGroup>
<xp:saveDocument var="document1"></xp:saveDocument>
<xp:openPage name="/adminDrafts.xsp"></xp:openPage>
</xp:actionGroup>
</xp:this.action></xp:eventHandler></xp:button>
</xp:view>
Once saved, the document cannot be opened anymore as the infamous 32k error message is displayed.
If I save with less than 32K, the document is ok, but the rich text field has the issummary flag to yes... That is mostly the cause of my problem...
As you are using option computeWithForm make sure your form "fPage" contains your rich text field and is of type rich text. Otherwise it might get converted to a normal text field.
Use option computeWithForm only if you really need to as it an expensive operation.
I'm going crazy: I cannot access the selected value of a combobox in the onchange event:
<xp:comboBox id="comboBox1" value="#{sessionScope.groupBy}">
<xp:selectItem itemLabel="nothing" itemValue=""></xp:selectItem>
<xp:selectItem itemLabel="State" itemValue="state"></xp:selectItem>
<xp:selectItem itemLabel="CCType" itemValue="cctype"></xp:selectItem>
<xp:eventHandler event="onchange" submit="true" refreshMode="complete">
<xp:this.action>
<xp:executeScript>
<xp:this.script>
<![CDATA[
#{javascript:sessionScope.groupBy = getComponent("comboBox1").getValue();
print( getComponent("comboBox1").getValue() )}
]]>
</xp:this.script>
</xp:executeScript>
</xp:this.action>
</xp:eventHandler>
</xp:comboBox>
I want to store the value and reload the page to access the value I just submitted. I also tried getSubmittedValue() and value only. They always return null.
What is the trick here?
I have a problem similar to that one but if I understand your quandary I may have a solution. You are trying to capture the value of a combo box field that you select correct? Here is the code for the combo box (name: POVendor). The view I'm drawing the list from is named "PLBV".
#DbColumn(#DbName(), "PLBV", 1)
Here is the code for the Computed field that captures the value of the selection in the combo box. Just do a partial refresh on the computed field from the combo box & it should work fine.
var item = document1.getValue("POVendor");
return item;
I was facing the similar issue, tried the below option and it worked for me.
Set the Server Options on the onChange event of the combobox to Full Update and check the option "Process Data without validation
This will give you the desired result.(Your sessionScope.groupBy will be set to the new selected value of the combobox.
I'm using a the extension library value picker to select a Name. Once the user hits Ok, I need to use the selected value to populate several other fields. But I can't figure out how to fire a SSJS function from the Ok button.
Thanks for any suggestions.
-- Jeff
You can fire an event from the field that the value picker updates.
Here's a simple example that updates another field when the value picker is used:
<xe:djextListTextBox id="inputField">
<xp:eventHandler event="onChange" submit="true" refreshMode="complete">
<xe:this.action><![CDATA[#{javascript:getComponent("testField").setValue(getComponent("inputField").getValue())}]]></xe:this.action>
</xp:eventHandler>
</xe:djextListTextBox>
<xe:valuePicker id="valuePicker1" for="inputField">
<xe:this.dataProvider>
<xe:simpleValuePicker valueList="1,2,3" valueListSeparator=","></xe:simpleValuePicker>
</xe:this.dataProvider>
</xe:valuePicker>
<xp:br />
<xp:inputText id="testField"></xp:inputText>