Skip to content

Commit

Permalink
XIVY-12667 Added dynamic placeholder for recipient
Browse files Browse the repository at this point in the history
  • Loading branch information
ivy-fhe committed Nov 2, 2023
1 parent da7e559 commit b38cc48
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
value="Receiver (one per line) ThreemaId / Email / Phone (international format)" />
<p:inputTextarea id="sendDemoMessageDataReceiver"
value="#{data.sendDemoMessageData.receiver}" rows="10"
cols="50" required="true" />
cols="50" required="true"/>

</p:panelGrid>
<br />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:ic="http://ivyteam.ch/jsf/component"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions">
xmlns:pe="http://primefaces.org/ui/extensions">
<h:body>
<ui:composition template="/layouts/frame-10.xhtml">
<ui:define name="title">singleRecipient</ui:define>
Expand All @@ -27,21 +27,19 @@
<p:outputLabel for="sendDemoMessageDataReceiver"
value="Receiver" />
<p:inputText id="sendDemoMessageDataReceiver"
value="#{data.sendDemoMessageData.receiver}" required="true" placeholder="placeholder"></p:inputText>
value="#{data.sendDemoMessageData.receiver}" required="true" placeholder="recipient"></p:inputText>

<p:outputLabel for="typeSelection" value="Receiver Type"/>
<p:selectOneRadio id="typeSelection"
value="#{data.sendDemoMessageData.type}"
layout="lineDirection" required="true">
layout="lineDirection" required="true" onchange="updatePlaceholder(value)">
<f:selectItem itemLabel="E-Mail" itemValue="email"
id="radioEmail" />
<f:selectItem itemLabel="Phone" itemValue="phone"
id="radioPhone" />
<f:selectItem itemLabel="ThreemaID" itemValue="threemaid"
id="radioThreemaid" />
</p:selectOneRadio>


</p:panelGrid>
<br />
<div class="command-btns">
Expand All @@ -51,7 +49,28 @@
value="Send" update="form" icon="pi pi-send" />
</div>
</h:form>


<script>
const updatePlaceholder = (value) => {
let newPlaceholder = '';
switch(value){
case "phone":
newPlaceholder = "+41790000000";
break;
case "email":
newPlaceholder = "[email protected]";
break;
case "threemaid":
newPlaceholder = "ECHOECHO";
break;
default:
newPlaceholder = "recipient";
break;
}
document.getElementById('form:sendDemoMessageDataReceiver').placeholder = newPlaceholder;
}
</script>

</ui:define>
</ui:composition>
</h:body>
Expand Down

0 comments on commit b38cc48

Please sign in to comment.