This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Mar 23, 2012, 2:07 PM
9 Posts
topic has been resolvedResolved

Prompt for user input and write to field?

  • Category: Other
  • Platform: Mobile
  • Release: 8.5.3
  • Role: Developer
  • Tags: XSP,Prompt
  • Replies: 1
I am new to XPages development and working on a mobile form for approvals.
 
I am trying to create a button to Req More Info.  I would like to prompt the user for comments and add them to a field.  I would then add the field to an email that is sent using an agent.
 
I have included a sample of the code below.  My question is... how do I take the results of the Prompt and put them into a field in the document?
 
Any help would be appreciated!   

<xp:button value="Req More Info - Supv" id="button1">

<xp:eventHandler event="onclick" submit="true" refreshMode="complete" id="eventHandler1">

<xp:this.script>

<![CDATA[

var msg = XSP.prompt("Enter (optional) brief message to include in request:");

 **I have tried several things here to add the value to the document or make it available to be added below with @SetField, with no success** 

]]>

</xp:this.script>

<xp:this.action>

<![CDATA[#{javascript:var roles = context.getUser().getRoles().toArray();

if (@IsMember('[CIO]',roles))

{

@SetField('Appr4','Pending-Supervisor');

@SetField('AprSign4',@Name("[CN]",@UserName()));

@SetField('AprSignDate4',@Now());

viewScope.actionPerformed="submitByCIO";

save();

context.redirectToPage("mobileRequestApprovedFinal.xsp")

}}]]></xp:this.action>

</xp:eventHandler>

</xp:button>

Mar 26, 2012, 6:53 PM
9 Posts
Re: Prompt for user input and write to field?
I have posted the answer below.  I think I just needed to walk away from it for a weekend and then come back to it.  Below is the code I used to set the field value:
 

var msg = XSP.prompt("Enter (optional) brief message to include in request:");

var AprReason4 = document.getElementById("#{id:aprReason41}");

AprReason4.value=msg;

 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal