I have a simple xPage with a button. I want to disable the button whenever the user is not the user "X". How can I do that? I tried to make Computed value for the "Disabled" field and failed all the time. Any suggestions?
Fixed the problem with:
getComponent("computedField1").getValue() == "User: x"
I didn't notice that I had "User" string attached to the computed field, so it returned false all the time. Thanks for help everyone!
Related
I have a radio group button, on a page, with very simple onChange code (tried with onClick also) which reads:
try{
print("1");
print("2");
}catch(e){
openLogBean.addError(e,this.getParent());
}
There is a partial refresh with id set to the div containing all my page content. The refresh fires as expected, but the code doesn't run. I have worked out, it is because of validation on other fields, as when I turn validation off for these fields, the code runs.
The question is, how can I get this code to run, whilst leaving validation on for the other fields? I've tried setting "Do not validate or update data" and "Process data without validation" set on my radio group where I want to fire the code, but no such luck. Thanks
Seems "Do not validate or update data" does do the trick, I think my application hadn't built properly first few times around. Leaving here for as an answer for anyone else with similar question
EDIT:
As per Paul's comment below "Process data without validation" will update the server-side and should be the one to use.
I would like to clear the input field of my app when user clicks the save button and the input values are successfully saved.
just use input->value(""); that´s all.
I am working in Kentico 8.2, and I want the user to have to accept all of the terms and conditions. For this, I am using a check box. If that check box is unchecked then user will not be able to submit the form.
This is not achievable through Kentico help which says that I can achieve it by making the check box multiple choice. I have done this and it works but I want the check box's own validation to work.
I cannot attach a picture here otherwise I would show you guys what I have done so far.
If anyone has a solution then please help.
Do you use the basic Kentico forms module?
You can use Validation on a field.
in the Forms module:
new field "conditions"
check "Required"
default value unchecked
Validation "Add validation rule"
select General condition
Enter text > press edit and in the code tab add the following macro:
{%conditions.Value == 1%}
add an error message
dont forget to press Apply and save the field
This worked in my sample.
I don't know if this is a feature or a bug: In an inputText control, bound to an item of a notes document, the value is overwritten each time the xpage is reopened and saved by the defaultvalue when the inputText control is flagged as disabled:
<xp:inputText
value="#{fback.EmployeeIDCreator}" id="EmployeeIDCreator1"
defaultValue="#{javascript:sessionScope.meUser.EmployeeID}"
style="width:94px" disabled="true" />
I expected the same behaviour as in "normal" (=enabled) items:
defaultValue assigned when document/xpage is new and the item is created,
field value when xpage is reopened and reedited.
Is this the "wished" behaviour?
thx in advance, Uwe
We'd run into this problem with fields that were marked 'readonly' as well. Set the style on the inputText to "display:none;" and have a separate control that displays the value. That way, your default value is saved in the field, but the user cannot edit it.
Looks to be a bug. Reproducible on R9.0.1: disabled state of edit field resets its binded value to default value on save.
We have a ticket open with HCL for this in 11.0.1 - CS0306235
The initial HCL response was "working as expected"
Subsequently someone in HCL raised this "Aha!" ticket because they disagreed - go vote for the "idea" - https://domino-ideas.hcltechsw.com/ideas/DDXP-I-980
In our case the workaround is to include .isNewNote() in an if statement as a condition of the default value.
<xp:this.defaultValue><![CDATA[#{javascript:if (document1.isNewNote()){
var addQText = getDbSettingsValueBlk('Configurable Additional Questions Text') ;
if (addQText==''){
// do nothing
}else {
return addQText;
}
}}]]></xp:this.defaultValue>
I have edit box which has validation- it is required field and it has range of values validation as well. The validation works ok, but the problem is that error message does not dissapear when I replace the values in edit box with valid ones. I tried to add full update on onchange event but this is not a option for me since this changes other fields in my xpage as well. The partial update on the field does not work. Any advice how to refresh the field so that error message dissapears?
Create a wrapper panel or div around BOTH the field and the error message control and set it's ID to the one that should be partially refreshed. I assume you use
XSP.partialRefreshGet("#{id:idOfYourField}")
in the onblur client event!? So just change the ID name here.