Guidewire - Adding numeric validation for Phone Number text field in PCF - pcf

I am looking to add validation to a Guidewire PCF field that checks to ensure that only numeric values are used in a Phone Number text field.

Answer: check the PCF's properties for userInputRestriction. Select the desired validation restriction (see picture). Additional item descriptions for how these validations are used can be found in comments under the PCF.xsd file.
Result:

Related

In a PDF, How to auto populate one field using other field text?

I have a 54 pages PDF file. In this PDF, I have some fields like Full Name, the Phone number, etc that repeats more than 10 times. How can do like When I enter Full name one time and all of the remaining full name fields can be filled automatically using Adobe Acrobat?
I hope I asked my question clearly. Thank you for your time and help.
The easiest is, when all properties of the field (font type, size, color, etc.) are the same, to simply copy the field to the other pages.
The field value is a so-called field level property, which will be the same for all instances of the field.
If you want to have only one place where the value can be entered, and the dependent fields should be read-only, you would have to have a different name for the entry field and display fields. In the entry field, you would then add the following line of code in either the Format or onBlur event:
this.getField("myDisplayFields").value = event.value ;
And that should push the value from the entry field to all fields named myDisplayFields.
And that's it…

Radio Button List validation

I want to validate Status three ways:
Status is a required field: a user must select one status.
If user selects Accept, then:
Qty Rejected should be Disabled
Comments are not compulsory. The user may leave a comment or not.
If user select Reject, then:
The user must put valid range of Qty Rejected, from 1 to 1000 with no non-numeric characters.
Must place a Comment.
How can I achieve this?
Javascript would be your best route for this. An easier route would also be to use jQuery.
Always recheck the information passed to you server side again. I know it seems redundant, but it's for your safety and it provides a better user experience.
You can choose to use javascript/jQuery for all the validations. But you can also use Data Annotations, [Required].
So, using your numbers above:
1) you can use the Data Annotation or JS/jQuery.
2) You can will have to use Data Annotations and/or JS/jQuery. The Data Annotation can handle making sure the input is a number and between 1 and 1000. You will have to use JS/jQuery to check if the Accept/Reject radio button was selected, or disable the Qty Rejected input based on the radio button selection.
3) The comments section can be declared required using JS/jQuery based on the radio button as well.
Info/examples on javascript validation: http://www.w3schools.com/js/js_validation.asp

Logic in merge tags, Gravity Forms

I am creating a few Notifications in Gravity Forms and I would like to use some "if/else" logic based on field entries.
For example, I have a Buyer 1 Name field and a checkbox that asks "Would you like to add another buyer?" When they check it, a new Name field appears for Buyer 2. In my Notification I would like to say "The following buyer...." if only the first name is completed, and "The following buyers..." if the 2nd name is filled in. Basically make buyer plural. I could give about 10 more examples of needing logic INSIDE the merge tags, really surprised this isn't available. Thoughts?
You want to use a Gravity Forms conditional shortcode in your notification message. It looks like this:
[gravityforms action="conditional" merge_tag="{Field:1}" condition="is" value="desired value"]Show this content if the field is equal to the field value I specified earlier[/gravityforms]
You can also check out this full tutorial (images included).

getting textfield output partly unvisible

In a Drupal content type a need to get the output of a field partly unvisible. These are bank account details, the IBAN.
Normally the field shows 1234567. I need to get xxxx567. I need to show only the last 3 numbers/letters.
Also I need this output in field edit form.
On the display end you could change the output using a simple PHP function in the theme template by grabbing a substring of the field's last three digits and concatenating it with "xxxx" before printing.
You might also consider doing this at the formatter level by using the 'custom formatter' module perhaps?
https://drupal.org/project/custom_formatters
To do this on the edit screen is trickier. I suppose you could do a hook form alter to use PHP to change the field value, but I am afraid you will rewrite the field value when you save the node with the 'xxxx' instead of the real data.
I wonder if it would make sense to 1.) hide the actual field, 2.) create a dummy field that displays the text formatted as "xxxx567" to the user, and 3.) write some javascript that populates the hidden field with the visible field's value if it is changed. Presumably the form would still throw values if the hidden field did not meet formatting requirements.

What is the purpose and proper use of a textfields max-length property?

What is the purpose and proper use of the max-length property on text fields?
The application I'm working on limits numeric fields to 6 characters... which doesn't work very well for entering millions of dollars... which is why I'm "fixing" it.
MaxLength Sets or receives the maximum number of characters that a user can enter into a Text control.
EDIT: You do this to prevent having to process something that you know is guaranteed to be wrong.
If you have a text field in your database that is set to 10 characters and the user enters 11 and you don't handle it properly, you cause an exception.
So, just set the maxlength to 10 and you won't have any problems like this.
The Maximum length attribute of a text field and/or textarea effectively limits the user from entering data that is outside the bounds and constraints you have set for your database.
You can use this to make sure users enter in valid SKU numbers, blog titles, ISBN numbers, etc. It is a rudimentary form of data validation.
This doesn't always need to be tied to data validation though.
You could want to limit the length of a string that a user has entered for aesthetic reasons when displaying that data on a page in another location.

Resources