Is it possible to add a character to a fillable text field? for instance a text filed asks for name so they type John, I want to have a < or something added to that field on a var this.getField command.
Is it possible to add a character to a fillable text field? for instance a text filed asks for name so they type John, I want to have a < or something added to that field on a var this.getField command.
Change the cQuestion and cTitle with your question and title.
var t = this.getField("textInput"); // the target field
var cResponse = app.response({
cQuestion: "What do you like about Acrobat?",
cTitle: "Favorite Acrobat feature!"});
{
if ( cResponse == null)
app.alert("Please complete the question."); // if Cancel is selected
else
app.alert("You responded, \""+cResponse+"\", is this correct?",2);
}
t.value = cResponse; // places the data from the dialog to the target field
}Second option:
Create a button(btnQuestion) and text field (UserName). Modify the code to add the special character.
Add this Javascript to the buttons Mouse Up action:
// Dialog Definition
var oDlg =
{
strName: "",
initialize: function(dialog)
{
dialog.load({"usnm":this.strName});
},
commit: function(dialog)
{
var data = dialog.store();
this.strName = data["usnm"];
},
description:
{
name: "Test Dialog",
elements:
[
{
type: "view",
elements:
[
{
name: "Enter your name:",
type: "static_text",
},
{
item_id: "usnm",
type: "edit_text",
char_width: 15
},
{
type: "ok_cancel",
},
]
},
]
}
};
// Dialog Activation
oDlg.strName = this.getField("UserName").value;
if("ok" == app.execDialog(oDlg))
{
this.getField("UserName").value = oDlg.strName;
}
My favorite quote - "Success is the ability to go from one failure to another with no loss of enthusiasm.