Tips and hints

Please post general news and welcomes here
User avatar
steve.runyeard
Posts: 3
Joined: Fri Aug 24, 2018 9:19 am

Tips and hints

Postby steve.runyeard » Fri Oct 12, 2018 10:36 am

Here's a regular expression you might find useful. It will match against UK currency amounts (with optional pound and pence symbols).

Examples of values that will match:
1.12
£1.12
12p
£145.55
£11,400.15

Regex:
^\£?\-?(?:0|[1-9]\d{0,2}(?:,?\d{3})*)(?:\.\d+)?p?$
User avatar
steve.runyeard
Posts: 3
Joined: Fri Aug 24, 2018 9:19 am

Re: Tips and hints

Postby steve.runyeard » Fri Oct 12, 2018 10:49 am

If you have a form page and you want all the empty input boxes to default to the value of zero when you progress to the next page then create yourself a custom action containing the following:

$("input").each(function(){
var input = $(this);
var value = input.val();
if(value=="")
input.val(0);
});

Then you simply put this custom action on the click event of the 'Next' button just before any validation is done (if you have validation) or just before the form action to navigate to the next page.
User avatar
steve.runyeard
Posts: 3
Joined: Fri Aug 24, 2018 9:19 am

Re: Tips and hints

Postby steve.runyeard » Fri Oct 12, 2018 3:03 pm

Do you need to create a button with a dynamic link? Here's a method. Put the values you wish to use in your link into hidden values and then in the click action on the button call some custom Javascript to build the url and then navigate to it.

The following custom action will create the link to resume a form using a form id and password from hidden fields.

var formId = $('#myPage_C41_').val();
var formPassword = $('#myPage_C42_').val();
window.open("~?a=myform&action=resume&f="+formId+"&pwd="+formPassword);

Who is online

Users browsing this forum: No registered users and 1 guest