BF : Test for limit number

  • Gilles361
  • Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 203
  • Thank you received: 5

Gilles361 created the topic: BF : Test for limit number

Hi,

BF Multi-pages, I would like to jump to an CLOSED page, if "Nb of records" is over a Limit Nb, else to continue to the Form (p3).

1/ I have create on P1 a "hidden element (Nb)" with "default value = 10 (my limit), then I've add script but it doesn't work correctly:
function ff_Nb_init() {
var Nb1 = ff_getElementByName("Nb").value ; // Nb limite
var Nb2 = 3 ; // Nb2 = Nb of records (I will calculate later)

// Test NB2 < Nb1 = Limite (Nb)
if ( Nb2 < Nb1 ) { // Continue Form
ff_switchpage(3) ; }
else { // NB > Limite : Go to closed page
ff_switchpage(2) ; }
} // function ff_Nb_init

Could you please help?
Thks,
#238127
  • Posts: 2734
  • Karma: 93
  • Thank you received: 369

mihaela replied the topic: BF : Test for limit number

Hello,

I have tested the Initscript code that you have provided and, for me, it is working fine.

When I enter the form I am momentarily being redirected to page 3, since 3<10.

Please check whether you have checked the "Form Entry" or "Page Entry" checkbox in the initscript section. In case you haven't this would not work.

Regards,

Mihaela
#238133
  • Gilles361
  • Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 203
  • Thank you received: 5

Gilles361 replied the topic: BF : Test for limit number

Hi,
Yes, you are right! I may have fix my bug while translating to English...

How to display "Nb" value in page 2 (over limit), in "PAGE edit" message or another trick?
thks, Gil
#238135
  • Posts: 2734
  • Karma: 93
  • Thank you received: 369

mihaela replied the topic: BF : Test for limit number

Hello,

I'm sorry but I do not understand what you are asking.

If I've understood previously, Nb has a predefined value 10 so you can just write that number where needed.

Regards,

Mihaela
#238140
  • Gilles361
  • Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 203
  • Thank you received: 5

Gilles361 replied the topic: BF : Test for limit number

Once I jump to "Form close" page (2), I've TEXT + Image message. Also, I would like to DISPLAY : "Nb of records" or "Nb = Limit" element value.

Rgds, Gil
#238142
  • Posts: 2734
  • Karma: 93
  • Thank you received: 369

mihaela replied the topic: BF : Test for limit number

Hello,

Maybe it would be the best that on this second page you create a Textfield and mark it as read-only.
Then you can write Initscript for this element to copy the value from Nb to this field on the second page.

The other solution, how to compone this into wanted intro text is a bit more complicated. To achieve so, do as follows:

1) Go to the Edit > Intro of your page (2). In the editor go to Tools > Source Code.
In the box that appears add this HTML code:
Nb of records is <span id="myid">newtext</span>
Make sure to save the whole form to save the change.

2) Go to form's Advanced properties > More options and in Initialization script set type to Custom and put there the following code:
function ff_FORMNAME_init()
{
setInterval('calc()', 500);
} // ff_FORMNAME_init

function calc() {
var pom=  ff_getElementByName('Nb').value;
jQuery("#myid").text(pom);
}
NOTE: In the code above replace FORMNAME with the actual name of your form.

That will, for example, result in a text like this on the second page:
"Nb of records is 8".

Let me know whether you have managed to set this for your form and whether it is working as you wanted.

Regards,

Mihaela
#238143
Moderators: ForumSupporttomeperica
Time to create page: 0.070 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here