Strange behavior in Xpages with Richtextfield and listbox with client event "onchange"

I tried to give a ListBox validation. The standardways over “AllProperties” “validator” does not work in my application.So i tried to handle this with an Clientside javascript and discovered the following:

I entered javascript to the "onchange"client-event in the listbox. For testing the script I got this picture in the IE.

The Richtextfield is limited to one sign. And the refresh of the field “subcategory” does not work anymore.

Code in the web:

RICHTEXT

(Equal to the correct representation)

LISTBOX

(Equal to the correct representation)

SCRIPTING

new ibm.domino.widget.layout.DominoRichText({}, 'view:_id1:_id25:inputRichText1').initForEdit(); function view__id1__id25__id30_clientSide_onchange(thisEvent) { var sc = document1.getItemValue("cmbKategorie") var bool = "false"; if (sc =="" || sc =="<Bitte eine Kategorie auswählen>") bool = false else bool = false; if (bool) alert("fehler") else alert("alles gut") } ............ new ibm.domino.widget.layout.DominoRichText({}, 'view:_id1:_id25:inputRichText1').initForEdit(); ..... Code in the XPage: CSS: out of oneUI Can anyone tell me, what happens here? Im sure, that the script is not correct, but it should not have this effect. When I remove the script, the representation ist correct again. Thank you Wolfgang

Subject: Is your client side script correctly formatted?

Hi,I think I’m able to reproduce this issue, and fix it.

When I tried your source, the Rich Text Editor (RTE) didn’t display. Is that what you’re seeing?

I then changed…

var sc = document1.getItemValue(“cmbKategorie”)

var bool = “false”;

if (sc ==“” || sc ==“<Bitte eine Kategorie auswählen>”) bool=false else bool=true;

if (bool) alert(“fehler”) else alert(“alles gut”)

…to…

var sc = document1.getItemValue(“cmbKategorie”)

var bool = “false”;

if (sc ==“” || sc ==“<Bitte eine Kategorie auswählen>”)

bool=false

else bool=true;

if (bool)

alert(“fehler”)

else alert(“alles gut”)

…and it worked.

But I don’t know why putting page returns after ‘sc ==“<Bitte eine Kategorie auswählen>”)’, ‘bool=false’, ‘if (bool)’, and ‘alert(“fehler”)’ might make things work?!

So could there be something amiss from the formatting?

Subject: Validation of two dependent Listboxes

Thank you for your help, Paul.

I pass the code which is working:

The “save”- Botton has follwing code:

<xp:button value=" Save" id=“save"icon=”/images/icon_save.gif" rendered=“#{javascript:document1.isEditable()}”>

<xp:eventHandler event="onclick"refreshMode=“complete” immediate=“false” submit=“true”>

xp:this.action

<xp:actionGroup>
	<xp:modifyField name="TxtBeschreibung">

		<xp:this.value>
		</xp:this.value>

	</xp:modifyField>

	<xp:modifyField name="datValidUntil">

		<xp:this.value>
		</xp:this.value>

	</xp:modifyField>

	<xp:modifyField name="SendTo">

		<xp:this.value>
		</xp:modifyField>

	<xp:modifyField name="Autor">

		<xp:this.value>
		</xp:this.value>

	</xp:modifyField>

	<xp:modifyField name="rbtYesNo">

		<xp:this.value>
		</xp:this.value>

	</xp:modifyField>

<xp:executeScript>
<xp:this.script>

</xp:executeScript>

</xp:actionGroup>

</xp:this.action>

xp:this.handlers

<xp:handler type="text/javascript">

	<xp:this.script>
</xp:handler>

</xp:this.handlers>

</xp:eventHandler>

</xp:button>

OPEN: When you press the Save-Botton the page is still reloaded with the entered values.

I haven’t found a way yet to set the “submit” to false in case of a failed validation.

(I am not even sure, that this will prevent a reload.)