473,387 Members | 1,628 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Format of textfield of livecycle designer

2
Hi there. I got the following script for the format of an inputted number (7 spaces). If entered as "1" the format will be changed to "0000001". Now I want to get this effect: if entered as "f1", the format will be changed to "F0000001". How can modify the script to achieve that? Thanks.

Expand|Select|Wrap|Line Numbers
  1. if (!(this.isNull)) {
  2. var tf = this.rawValue;
  3. if (tf < 1 ) {
  4. xfa.host.messageBox("The number must be a numeral starting from 1.","Incorrect Number",1);
  5. xfa.host.setFocus("TextField27"); }
  6. if (tf.length < 7) {
  7. var diff = 7 - tf.length;
  8. for (var i=0;i < diff;i++) {
  9. tf = "0" + tf;}
  10. this.rawValue = tf;}
  11. var regExp = /\d{7}/;//}
  12. if (!(regExp.test(tf))) {
  13. xfa.host.messageBox("The number must be in the format of 9999999.","Validation",1);
  14. this.rawValue = "";
  15. xfa.host.setFocus("TextField27");}}
Nov 9 '11 #1
3 4416
acoder
16,027 Expert Mod 8TB
Would this be for the same field or for a different field? In other words, do you want to allow both formats in the same field or this is to apply to a different field?

In any case, lines 6-10 change the format from 1 to 0000001. The exact change would depend on the above question. You'd check for a length of 8 instead of 7 and separate the F and then use the same code.
Nov 9 '11 #2
rcwip
2
Hi acoder, Thanks for your reply. What I intend to do is providing user with a 8-character textfield for input. If user inputs "f1" or "f01" or similar entry, the display of the relevant textfield will be "F0000001". If the first character of the input is anything other than "f" or "F" or 0-9, it will prompt user with an error message. Can you please advise me how to modify my code to that effect. Thanks in advance.
Nov 10 '11 #3
acoder
16,027 Expert Mod 8TB
The problem here is that I'm not familiar with the exact syntax to use in LiveCycle's version of JavaScript. If you can find the code/function/method to get the character at a certain position, it should be easier to solve.

Here's a link to the documentation which should help: http://help.adobe.com/en_US/livecycl..._reference.pdf

You have 2 issues:
1. formatting
2. error checking

Error checking should be relatively straightforward with a regular expression, e.g. you could use something like:
Expand|Select|Wrap|Line Numbers
  1. var regExp = /^[fF]?\d{7}$/;
(not tested)

For the formatting, read the documentation to get the first character which you should check for either F or a number. Then you can split it off and add it back on after adding the required number of 0s.
Nov 10 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
Tovah137
by: Tovah137 | last post by:
I am trying to create a program of sorts in Adobe Livecycle 8.0, I want to make a message box pop up when you click on certain things asking "have you checked for ____", I want to be able to click...
2
by: harirenu | last post by:
hai, I have a textbox in my webpage where i enter the date through calander and the format is mm/dd/yy this date should be less than todays date.But I am getting problem when comparing the year....
6
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
Yesterday Visual Studio gave me a strange error both at compiletime and at designtime that had no obvious connection to anything I had changed recently. After some effort tracking down the problem...
3
by: GavReynolds | last post by:
Hi All I'm a bit lost......Was just wandering where i could post a question regarding a piece of code im using in Adobe LiveCycle Designer? Any help would be much Appreciated! Cheers Gav
2
by: Hugh | last post by:
The PyGUI website specified this place as the place for general discussion about it, so here goes.... First off - thanks for something that is so straightforward to get running on OSX... I've...
1
by: Rossouw | last post by:
I a working in Adobe LiveCycle Designer ES, and I am quite new to it. I have a couple of questions that I want to ask. If somebody know of a good source or a good source of coded examples, then...
5
by: spitfiregt6 | last post by:
Using Adobe LiveCycle Designer, I can't get the script below to work using "formcalc" (a type of Javascript). I use this to calculate shipping costs for car club items by their weight in a pdf...
2
by: ali white | last post by:
Distributed forms. We need a simple way to detect the end user has changed the content of a form field and to highlight the changed field colour as a result. The change needs to persist through Save...
0
by: Nanda R | last post by:
Hello All, I am new to the ADOBE Livecycle environment, but am very familiar with c#. I have create an editable form in ADOBE that works weel and shows data at design time. I am displaying data...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.