Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Input box Filmaker Pro 11

Posted on 2011-09-05
2
Medium Priority
?
431 Views
Last Modified: 2012-05-12
I have a database (see attached) it hase a one table and a main layout. The layout out has a button that lets the user enter any number. The inputted number populates the field 'Enter_Number' which is set to receive only numeric data. Is there a way that when the users inputs their answers, the script can check to see that the value entered is indeed only numbers.
InputBox.fp7
0
Comment
Question by:PachecoPrimo
2 Comments
 
LVL 12

Expert Comment

by:North2Alaska
ID: 36485736
I use a custom function, IsNumeric( value, separator ) that returns true or false.  I don't recall where I found it and I don't claim to have written it.  I just use it...


Let
(
   [
   decSep = If (separator = ""; "."; separator);

   trimmedValue = Trim (value);
   filteredValue = Filter ( trimmedValue ; "0123456789-" & decSep );
   lengthOk =    If (Length (trimmedValue) = Length (filteredValue);  True;  False);

   dotOccurence = PatternCount (filteredValue; decSep);
   dotOk = If (dotOccurence = 0 or dotOccurence = 1; True; False);

   minusIndex = Position (filteredValue; "-"; 1; 1);
   minusOk = If (minusIndex = 0 or minusIndex = 1; True; False)
   ];
   If (lengthOk and dotOk and minusOk;
      True;
   /*else*/
      False
   )
)

Open in new window

0
 
LVL 1

Accepted Solution

by:
soholm earned 2000 total points
ID: 36522197
A way to check if the entered value is indeed numbers could be this:

Exact (Main::Enter_Number ; GetAsNumber( Main::Enter_Number) )

Open in new window


Unfortunately, the isValid() function will not cover here. It will return 'true' for a number field as long as the input contains some number even if the input also contains letters and other characters.

You may have perfectly good reasons for scripting this, but consider just using an input field on the layout instead. If you define the input field to "Always" validate instead of "Only during data entry" you may rely on FileMaker taking care of the testing instead, regardless the input situation. You may also want to clean up the input by using the nice filtering custom function proposed by North2Alaska.

The build-in FileMaker alert does not aestetically work well on top of a scripted custom dialogue box, which is another reason for avoiding a dialogue box if possible.

This could be done by putting an auto-enter calculation on the input-field. When entering you run above 'exact'-test, and if it fails you simply reset the field.

Finally, you can add script triggers on the input field if you need any further functionality to run at the time of input.

Hope this may help.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Pop up windows can be a useful feature of any Filemaker database.  Though best used sparingly, they can be employed in a multitude of different ways, for example;  as a splash screen at login, during scripted processes to control user input, as pick…
Problem: You have a hosted FileMaker database and users are tired of having to use Open Remote or Open Recent to access the database. They say, "can't you just give us something to double-click on rather than have to go through those dialogs?" An…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question