Replace Characters in a Text Field
Hello,
I have a script to replace a carriage return in a text box.
The script is not working when run from the console.
Can any one please advise how the script can be revised to find/replace a carriage return in a multiline text box?
var t = this.getField("ActionAgenda").value;
t = t.replace("\r","") // delete carriage return
Any assistance would be most appreciated.
Thank you for your help, George.
The script works perfectly to replace carriage returns in a text field.
Can you please advise how to modify the same script to remove a blank line instead of a carriage return?
Thanks again, George.
Regards
Jo
Similar Messages
-
Limit the amount of characters of a text field based on first digit
Hello and thanks in advance for your help!
I would like to limit the amount of characters of the text field based on the first digit of the number (the text field is only limited to a number format...no decimals, no commas).
For example, if the number begins with a 3, I would like to limit the text field to allow only ten characters. I have three scenarios but if I could get started with some code and what is the best place to add it (keystroke or validation?) I can take it from there. Thanks again for your help!!I've written this code for you that does that. Use it as the field's custom Keystroke code:
// Validate that only digits are entered
if (event.change) {
event.rc = /^\d+$/.test(event.change);
// Validate string length if it starts with 3
if (/^3/.test(AFMergeChange(event))) {
event.rc = AFMergeChange(event).length <= 10;
if (!event.rc) app.alert("If the number starts with \"3\" it may not be longer than 10 digits.",1); // optional error message
You can duplicate the second part of it for additional conditions, but keep in mind that this code won't even let you remove the first character in the field if the result is an invalid one.
For example, if you enter "234567890123456" then you can't remove the "2" at the start because that would result in an invalid number. You can remove any of the other digits, though, and when it's 10 digits or less then you could remove the starting "2" as well. -
Search and Replace values in the text field before values are stored to DB
Hi,
In my application there is a question - text area and answer - text field. Problem is, some answers are stored with the single quotes to the DB and I have a problem while retrieving it from the DB. I need to replace the 1 single quotes with 2 single quotes. The values are stored to the DB when the submit button is clicked.
So I am using the following javascript code:
italics
<script type="text/javascript">
function test()
var str="&P2_S1.";
document.write(escape(str));
</script>
italics
I need to call this javascript function, when the submit button is clicked but BEFORE the values are stored to the DB. How can i get this done?
Please let me know.Hi,
Thanks for the reply.
Yeah I planned to drop the Javascript idea.
Now, I am using the PL/SQL code. This is what I am planning to do.
When the user enters any word like this, Test's, this single quote should be replaced by some special character, #@@#, - what is the PL/SQL code for this?
Right now my PL/SQL code is:
begin
update test set S1=:P2_S1 where name=:APP_USER;
end;
so the replacing part should come somewhere before the update statement.... how can I do it?
from the DB when the values are retrieved, I use the following code:
select REPLACE(s1,'''','') from test where NAME=:APP_USER; // this works fine.
Please help me with the replace of the single quote before the update process... -
How to force all characters in prompt text field will be in uppercase???
Hi everybody
How to get that all characters in a prompt field of a Webi report will be compared in uppercase with the database field ?? Even if the user input text in lower case.
this is due to the database all filelds are in uppercase, and avoid to say to the users they input fileds in uppercase.
i looked for a parameter in a universe and in oracle.prm filed, and i didn´t find it.
Thanks in advance
Guillermo
DB: ORACLE 10G
BO: XI r2Thanks a lot rohy.
now i use that solution, but my intention is try to solve to all objects, not each object individualy, due to i have a lot of objects that a user can choose from a prompt, and i have a lot of filters to do that
i would like to change some parameter to do that at one time.
i investigate about it......
thanks again.
best regards Guillermo
have a nice day -
How can I do field validation on the last two characters of a text field?
I have a text field. The user is required to enter the last two characters as numbers. I want to apply validation on this field. How can i achieve the same?
EX: If the user enter ABCDE, an error messgae stating the last two digit should be numeric.
I tried using the below in the field validation which did not work.
(0+Right([<ExternalSystemId>],2)) > 0 AND (0+Right([<ExternalSystemId>],2)) < 99.
Any ideas would help?Try this-
FindOneOf(Right([<Field1>],"2"),"abcdefghijklmnopqrstuvwxyz")=0
rgds,
Amit -
Adding Start and Stop characters to a text field???
"For 1D bar codes, there are two options depending on the type of PDF form you want to use. Forms that you create in Acrobat (acroforms) can be set up to use a bar code font with a standard text field. If you want to include the standard start and stop character (*) and/or a check character, you can use JavaScript to add them. The check character would have to be calculated, but that can be easily done with JavaScript."
How would i go about doing this. My current PDF form will pull a last name and first name onto the form in a Barcode format, but i need to add in *LNM to the start and another * at the end of the data that was pulled from a SQL data base. example the pdf has a Text Feild named "borrower1_last_name" and that filed pulls the last name.. So i was thinking there should be an easy script like you said to add in to that feild properties.
posting here now, becasue no one seems to be able to point me to the correct resourse on the reader forum.okay.. so now how do I change the space between the first name and middle inital (and even the last name) in that same field?
something like this looks like it should work but doesnt seem to do anything.
str.replace(/ /g, "_");
// Add an asterisk to the beginning and end of the value
if (event.value) event.value = "*FNM" + event.value + "*";
//Replace black spaces with an Underscore
str.replace(/ /g, "_"); -
Automate replacing font in a text field in thousands of documents
Hi,
We recently discovered that bar codes we use on our forms do not scan accurately when printed on certain types of prined. To resolve this issue, we replaced this font with a new font.
Going forward any new form that we create will use the new font. But we have thousands and thousands of existing forms with the old bar codes. Can anyone give any suggestion on how to automate changing the bar code fonts in this forms.
If we manage to automate this, we will save months of manual effort.
Please get back to me if you have any suggestions that might help us.
Thanks for your time and help
- GeorgeI answered my own question regarding this with the following code
1. Set the TextField value to a variable strChar
2. Based on the indexOf value of strChar "UserName: Some UseName" which is 9.
3. Separate the first 9 chars using a Left javascript function and assign the to a variable strLeftChar = "UserName"
4. Separate the remainig chars using a Right javascript function and assign the to a variable strLRightChar = "Some UserName"
5. Then do the following:
//Make the caption visible
pricingNodes.item(i).caption.presence = "visible"
//Set the text field caption text equal to strLeft
pricingNodes.item(i).caption.value.text.value = strLeft;
//set the text field value text equal to strRight
pricingNodes.item(i).rawValue = " " + strRight;
//set the caption font weight equal to bold
pricingNodes.item(i).caption.font.weight = "bold";
Not that neat as a solution, but it does the job if this helps anyone. -
Special Characters in Long Text Field of FI Documents
Hi,
Users entered the following in the long text field of a FI document:
"Settlement of claims for direct shipment (Refer to XXX/YY-053/2009, XXX/YY-018/2009, XX2120000031 and X2120000033)"
The default editor used is the one which looks like the MS Word.
When we changd to the other editor (Goto > Change Editor), we see the following:
"Settlement of claims for direct shipment to Thailand (Refer to"
"XXX/YY-053/2009<(>,<)> XXX/YY-018/2009, XX2120000031 and X2120000033)"
How did "<(>,<)> " comes about?
Any ideas?I'd probably use a regex of "allowed" characters rather than a list of "disallowed" characters, but thats just a difference in approach.
I would probably use a regular expression - alphanumeric is fairly easy to check
String value = request.getParameter("enteredField");
boolean alphaNumericOnly = value.matches("\\w+");As a matter of being nice to the user, you can also do this check in javascript on the client side.
ALWAYS validate server side.
Optionally validate client side to give the user a better experience (less round trip requests)
Cheers,
evnafets -
To limit number of characters in a text field...
I did a little research. My goal is to limit the number of characters in the textfield by 50.
If the results of my research are correct, I have to create a JFormattedTextField, then use a MaskFormatter with a mask of 50 asteriks. Is that correct? Any other suggestions?
Thanks in advance.I've got a problem using a JFormattedTextField.
Each time the the text field gains focus, the caret does no move to the end of the text. It appears at the start of it. plus, any text i typed will overwrite the character already typed in, as if you've pressed the INSERT button during typing in a text editor.
What caused that and how do I resolve it?
Thanks a lot for the help ;) -
How To: Extract first three characters of a text field
Greetings --
What is the best method for extracting the first three
letters of a text field?
I need to extract the first three letters of a text field (in
this case Last Name),
so I add it to other components so as to create an
identification number for
a person.
This identification number that needs to be created is
comprised of the
person's date of birth, last 4 numbers of the social security
number and
the the first three letters of the person's last name.
Example:
==> Birthdate: 11/15/45
==> Last 4 SSN: 6654
==> Last Name: Smith
ID Number would be:
==> 1115456654SMI
Leonard BThat should do the trick:
I put your values in variable, just replace the names, as
needed
<cfset birthdate = "11/15/45">
<cfset ssn = "41646562121216654">
<cfset lastname = "Smith">
This deletes all the / from your birthday string (if it is a
string!) and puts it into the id variable:
<cfset id = replace(birthdate, "/", "", "All")>
This takes the last 4 letters/digits of your social security
number string and adds it to the id:
<cfset id = id & right(ssn,4)>
This takes the first thre letters/digits from your last name
variable, puts it in upper case and adds it to the id string
<cfset id = id & ucase(left(lastname,3))>
Hope it helps. -
Replace characters in chat text
I was written a small applescript to replace some characters in chat message. Here is my code.
property searchList : {"live"}
property replaceList : {"love"}
to switchText of t from s to r
set text item delimiters to s
set t to t's text items
set text item delimiters to r
tell t to set t to beginning & ({""} & rest)
t
end switchText
to convertText(t)
set d to text item delimiters
considering case
repeat with n from 1 to count searchList
set t to switchText of t from my searchList's item n to my replaceList's item n
end repeat
end considering
set text item delimiters to d
t
end convertText
using terms from application "Messages"
on message sent theMessage for theChat
try
return convertText(theMessage)
end try
end message sent
on message received theMessage from theBuddy for theChat
return convertText(theMessage)
end message received
on chat room message received theMessage from theBuddy for theChat
return convertText(theMessage)
end chat room message received
end using terms from
This code worked fine for Yahoo account, but it dont work when i received messages from iMessage and Jabber account. I tried to look into Alerts event and i found "Message received in active chat" ,maybe iMessage and Jabber account use this event to alert received message, but the problem is this object not defined in applescript. How can i define it, or make this code work with iMessage and Jabber account.after long long times for google and test myseft, i found yahoo account have problem too, because active chat why is apple dont define this object ""Message received in active chat"'
-
Animating characters in a text field
Hello,
I'm new to captivate and not sure that this is something I can do with captivate. I'm trying to create a course on spelling, and for that I would like to have sentences or words on the screen that, at certain points in the presentation, have blinking characters or characters with different colors. I have not found a way to do that, is it at all possible, or would you recommend to use something else to create this?
Thank you,
AlexOK. I think I get the idea. I doubt that Captivate will be the right tool for your task. I'm not saying it would be impossible, just that there are other tools out there (like Flash) that would offer you a greater level of control, albeit with a steeper learning curve.
In Captivate you can only animate or apply effects similar to what you describe on individual objects. So to use an Effect to animate or change the colour of something, but if you wanted to do this to an individual letter in a word, then each letter would need to be in a separate text caption or be a separate graphic.
There are lots of easier ways to make something stand out. If I had to teach language words, and I wanted to highlight a given letter in the word using Captivate, I'd probably make the words quite large, then use a Highlight Box placed over the letter and either use a border or set to Fill Outer Area with about 50% Alpha so that only the letter in the highlight box could be easily read. -
UDF to replace characters in free text?
Hi experts,
If I have dates such as "2009.11.12" in a free text I need to change those to "2009-11-12".
Basically I have to replace dots with a hyphen.
I am thinking of a UDF but could not find one in the forum. Does anyone have an idea how to achieve that?
Thank you very much for your help!
Best regards,
PeterYOu can make use of replaceString function.
Find its documentation here: http://help.sap.com/saphelp_erp2004/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
Or you can make use of DateTrans function and specify the delimiter of your choice.
Regards,
ravi -
Replace Select List with text field in Collection Code
hi
i am using an Collection Code .i have used an java script code to fetch rate of item with out refresh in column *(APEX_ITEM.SELECT_LIST_FROM_QUERY(10,a.c009).*
My problem is this column is Select List but i want to use in textfield here.
This is my Rate Column . How can i Replace it with textfield like APEX_ITEM.TEXT
APEX_ITEM.SELECT_LIST_FROM_QUERY(10,a.c009,'SELECT RATE D, RATE R FROM ITEM_DETAILS WHERE ITEM_NAME =''' || a.c006|| '''',
This is my Collection code
select APEX_ITEM.HIDDEN(1,SEQ_ID),
APEX_ITEM.TEXT(2,a.c001) c001,
APEX_ITEM.TEXT(3,a.c002) c002,
APEX_ITEM.TEXT(4,a.c003) c003,
APEX_ITEM.TEXT(5,a.c004) c004,
APEX_ITEM.SELECT_LIST_FROM_QUERY(6,a.c005,'SELECT ITEM_GROUP D,ITEM_GROUP R FROM ITEM_GROUP_DETAILS order by ITEM_GROUP',
'style="" '
||'onchange="get_select_list_xml(this,''f7_'|| LPAD (seq_id, 4, '0')
||''')"',
'YES',
'0',
'-Select-',
'f6_'|| LPAD (seq_id, 4, '0'),
NULL,
'NO') c005,
APEX_ITEM.SELECT_LIST_FROM_QUERY(7,a.c006,'SELECT ITEM_NAME D,ITEM_NAME R FROM ITEM_DETAILS WHERE ITEM_GROUP =''' || a.c005|| '''' ,
'style=""'
||'onchange="get_select_list_xml21(this,''f10_'|| LPAD (seq_id, 4, '0')
||''')"',
'YES',
'0',
'-Select Name -',
'f7_' || LPAD (seq_id, 4, '0'),
NULL,
'NO') c006,
APEX_ITEM.TEXT(8,a.c007) c007,
APEX_ITEM.TEXT(9,a.c008) c008,
APEX_ITEM.SELECT_LIST_FROM_QUERY(10,a.c009,'SELECT RATE D, RATE R FROM ITEM_DETAILS WHERE ITEM_NAME =''' || a.c006|| '''',
'style=""',
'YES',
'0',
'-Select Rate -',
'f10_' || LPAD (seq_id, 4, '0'),
NULL,
'NO') c009,
APEX_ITEM.TEXT(11,a.c010) c010
FROM APEX_collections a
where a.collection_name = 'ABC'
Thanks
Manoj Kaushik
Edited by: Manoj Kaushik on Mar 11, 2010 1:25 AMhi
i am using an Collection Code .i have used an java script code to fetch rate of item with out refresh in column *(APEX_ITEM.SELECT_LIST_FROM_QUERY(10,a.c009).*
My problem is this column is Select List but i want to use in textfield here.
This is my Rate Column . How can i Replace it with textfield like APEX_ITEM.TEXT
APEX_ITEM.SELECT_LIST_FROM_QUERY(10,a.c009,'SELECT RATE D, RATE R FROM ITEM_DETAILS WHERE ITEM_NAME =''' || a.c006|| '''',
This is my Collection code
select APEX_ITEM.HIDDEN(1,SEQ_ID),
APEX_ITEM.TEXT(2,a.c001) c001,
APEX_ITEM.TEXT(3,a.c002) c002,
APEX_ITEM.TEXT(4,a.c003) c003,
APEX_ITEM.TEXT(5,a.c004) c004,
APEX_ITEM.SELECT_LIST_FROM_QUERY(6,a.c005,'SELECT ITEM_GROUP D,ITEM_GROUP R FROM ITEM_GROUP_DETAILS order by ITEM_GROUP',
'style="" '
||'onchange="get_select_list_xml(this,''f7_'|| LPAD (seq_id, 4, '0')
||''')"',
'YES',
'0',
'-Select-',
'f6_'|| LPAD (seq_id, 4, '0'),
NULL,
'NO') c005,
APEX_ITEM.SELECT_LIST_FROM_QUERY(7,a.c006,'SELECT ITEM_NAME D,ITEM_NAME R FROM ITEM_DETAILS WHERE ITEM_GROUP =''' || a.c005|| '''' ,
'style=""'
||'onchange="get_select_list_xml21(this,''f10_'|| LPAD (seq_id, 4, '0')
||''')"',
'YES',
'0',
'-Select Name -',
'f7_' || LPAD (seq_id, 4, '0'),
NULL,
'NO') c006,
APEX_ITEM.TEXT(8,a.c007) c007,
APEX_ITEM.TEXT(9,a.c008) c008,
APEX_ITEM.SELECT_LIST_FROM_QUERY(10,a.c009,'SELECT RATE D, RATE R FROM ITEM_DETAILS WHERE ITEM_NAME =''' || a.c006|| '''',
'style=""',
'YES',
'0',
'-Select Rate -',
'f10_' || LPAD (seq_id, 4, '0'),
NULL,
'NO') c009,
APEX_ITEM.TEXT(11,a.c010) c010
FROM APEX_collections a
where a.collection_name = 'ABC'
Thanks
Manoj Kaushik
Edited by: Manoj Kaushik on Mar 11, 2010 1:25 AM -
Hope someone can help me.
What I basically need help with is how to make Acrobat add a comma after every 6 characters in a text field:
XXXXXX,YYYYYY, ZZZZZZ etcI'm sorry, but I did not understand that (i'm using Acrobat Pro X)
Am I supposed to go to:
Text Field Properties > Format > Custom
and then use Custom Format Script or Custom Keystroke Script?
I tried both and it did not work.
And do the Text Field have to be named "chunkSize"?
Seems like it works. I had to move to the next formfield in order to see the effect.
Is it possible to make it happen in real time (as you type the comma is inserted?)
Maybe you are looking for
-
How to use Weblogic Server 6.1 build.xml with ant
Hi Java's I have downloaded the latest version of BEA Weblogic server 6.1,they have changed the build.cmd to build.xml for compiling and building the ejb applications.they are telling that we have use $ant to run the build.xml but i couldn't able to
-
I have a lap top running leopard which has connected to virgin's wireless router (Net gear) My other computer is mac mini running Tiger. It initially connected to virgin wireless router. Suddenly it stopped connection to it. So no internet. Please le
-
I have an Airport hooked up to a Cable modem. Give wireless access to my MAC Book Pro, connects to my Ipad but will not have internet access, tried a different Airport with the same results. Please help.
-
Dynamically Changing Language of web content
Hi guys, here's my situation, i'm building a web application, and the user needs to be able to select the language of choice for displaying content.. as far as implementing this , i'm a bit lost, can anyboby out there point me in the right direction
-
Laptop running really slow even after OKR??
my laptop is running really slow before and after one key recovery? thx