Question to: AddDeleteRows

  • rd
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 62
  • Thank you received: 2

rd created the topic: Question to: AddDeleteRows

Hello Mihaela,

we build a form based on the demo form "AddDeleteRows" you provide on your site. And thanks to your help it works perfect.

Now we would like to improve this form in the following ways:

1) At the beginning only two rows are visible. The other rows are invisible. If you press add row the next row will be shown. So far so good.

Question: how do we change the amount of rows to be visible at start up? E.g. at start up instead of 2 rows there should be 3 or 4 or 5 being shown and the add button would display the 4th or 5th and so on ?

2)
Is there any way to automatically display rows that are invisible if there is any content filled out previously. Something like: If there is data of any kind inside a row put the state of this row to "visible" regardless of the fact that this row might be set to invisible initially?

Sometimes somebody prefills parts of the form and save it. A different person is than going to use this prefilled form and puts in the missing parts. Right now this person has to check if a row, that is invisible, has data inside. Right now, we have 12 rows, and the person have to look inside 10 if there is data inside. This is not only tedious but also causes errors.

Hope I was able to explain the problem :-)

Again, thank you very much for your help.
Regards,
Rolf
#234386
  • Posts: 2282
  • Karma: 84
  • Thank you received: 306

mihaela replied the topic: Question to: AddDeleteRows

Hello,

Here are instructions how to achieve what you want:

1) Navigate to BreezingForms > Manage Scripts and in Custom package you will find the "WrapperScriptAddDelete" script which controls turning sections on and off.

In the script you have to do the following changes
Replace this line:
var i=2;
with the following one:
var i=3;

Also, replace this line of code:
for (i;i>2;i--)
with the following one:
for (i;i>3;i--)

Furthermore, go to the form and in the Advanced properties of the "S3" section uncheck the "Turn off" checkbox.

That will show the 3rd section shown when form is entered and add button will add 4th section and so on.

Let me know whether you've managed to set this for your form.

2) It is possible to do so, but it requires some coding.
You would have to write an Initialization script which would check whether something is entered for each field in certain section.

For example, the code would go like this:
if(ff_getElementByName('Field1').value == ""  || ff_getElementByName('Field2').value == "" || ff_getElementByName('Field3').value == "") {
 JQuery('#S4').css('display', 'block');
}
Here it is predicted that Field1, Field2 and Field3 are the names of fields in 4th section.

Let me know whether you have managed to make it work for your form.

Regards,

Mihaela
#234420
  • rd
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 62
  • Thank you received: 2

rd replied the topic: Question to: AddDeleteRows

Hello Mihaela,

1) works as intended -- Thank you!
2) I have some problems with this script. I tried to show the 5th row. It has content but is invisible. I put in your code and replaced the field names with my field names. And I replaced S4 with S5. But it is not working. May I ask you to give more detailed instructions? Please have a look at the screenshot.


Regards,
Rolf
#234429
Attachments:
  • Posts: 2282
  • Karma: 84
  • Thank you received: 306

mihaela replied the topic: Question to: AddDeleteRows

Hello,

I see you have errors in the Initialization script.

All the code should be put inside this function:
function ff_formname_init()
{
  // code here
} // ff_formname_init

Only other functions can be defined outside this function, like this:
function ff_formname_init()
{
  WrapperScriptAddDelete();
 
  if( ff_getElementByName('bfQuickMode37913').value != ""  || ff_getElementByName('bfQuickMode64692').value != "" || ff_getElementByName('bfQuickMode12766').value != "") {
   jQuery('#S4').css('display', 'block');
   }
setInterval(totalprize, 500); 
} // ff_formname_init

function totalprize() {
   // function code here
}

NOTE: I have made a mistake in my previous post. In if statement it should be "!=" instead of "==".

Let me know whether you have managed to set make this work for your form.

Regards,

Mihaela
#234434
  • rd
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 62
  • Thank you received: 2

rd replied the topic: Question to: AddDeleteRows

Hello Mihaela,

it is not working. After adding the code the add/delete script stops working and the 5th row is still invisible. Guess I am still making something wrong.
function ff_AufmassMoebel_init()
{
if(ff_getElementByName('Beschreibung5').value != ""  || ff_getElementByName('T5X').value != "" || ff_getElementByName('T5Stck').value != "" || ff_getElementByName('T5Total').value != "") {
 JQuery('#S5').css('display', 'block');
} // ff_AufmassMoebel_init

function ff_AufmassMoebel_init()
{
  AufmassMoebel();  //comment: this calls the script that controls the add/delete function
} // ff_WrapperForm_init

{
setInterval('totalprize()',20);
} // ff_AddDeleteRows_init


function totalprize()
{
ff_getElementByName('SummeTotal').value =
Number(ff_getElementByName('T1Total').value) + 
Number(ff_getElementByName('T2Total').value) + 
Number(ff_getElementByName('T3Total').value) + 
Number(ff_getElementByName('T4Total').value) +
Number(ff_getElementByName('T5Total').value) +
Number(ff_getElementByName('T6Total').value) +
Number(ff_getElementByName('T7Total').value) +
Number(ff_getElementByName('T8Total').value) +
Number(ff_getElementByName('T9Total').value) +
Number(ff_getElementByName('T10Total').value) +
Number(ff_getElementByName('FaTotal1').value) +
Number(ff_getElementByName('AzTotal1').value) +
Number(ff_getElementByName('HeTotal1').value) +
Number(ff_getElementByName('FkTotal1').value) +
Number(ff_getElementByName('FaTotal2').value) +
Number(ff_getElementByName('AzTotal2').value) +
Number(ff_getElementByName('HeTotal2').value) +
Number(ff_getElementByName('FkTotal2').value);
}

Here is the Script controling the add/delete function: It is named AufmassMoebel:
function ff_AufmassMoebel_init()
{
  AufmassMoebel();
} // ff_WrapperForm_init
calls the script named AufmassMoebel. The content of this script is:
function AufmassFenster () {
var i=1;
var add=ff_getElementByName('plus').id;
var del=ff_getElementByName('minus').id;

JQuery('#'+add).click(function(){
   for (i;i<=20;i++)
   {
      var id='#S'+i;
      var setting = JQuery(id).css('display');
      if (setting=='none')
      {
         JQuery(id).css('display', 'block');
         break;
      }
   }
});
JQuery('#'+del).click(function(){
   for (i;i>1;i--)
   {
      var id='#S'+i;
      var setting = JQuery(id).css('display');
      if (setting=='block')
      {
         JQuery(id).css('display', 'none');
         break;
      }
   }
});
}

Regards,
Rolf
#234454
  • Posts: 2282
  • Karma: 84
  • Thank you received: 306

mihaela replied the topic: Question to: AddDeleteRows

Hello again,

You have errors in your code:

Please put this code instead in the Initialization script:
function ff_nameOfYourForm_init()
{
AufmassMoebel();
if(ff_getElementByName('Beschreibung5').value != ""  || ff_getElementByName('T5X').value != "" || ff_getElementByName('T5Stck').value != "" || ff_getElementByName('T5Total').value != "") {
     JQuery('#S5').css('display', 'block');
     }

 setInterval('totalprize()',20);

} // ff_nameOfYourForm_init


function totalprize()
{
ff_getElementByName('SummeTotal').value =
Number(ff_getElementByName('T1Total').value) + 
Number(ff_getElementByName('T2Total').value) + 
Number(ff_getElementByName('T3Total').value) + 
Number(ff_getElementByName('T4Total').value) +
Number(ff_getElementByName('T5Total').value) +
Number(ff_getElementByName('T6Total').value) +
Number(ff_getElementByName('T7Total').value) +
Number(ff_getElementByName('T8Total').value) +
Number(ff_getElementByName('T9Total').value) +
Number(ff_getElementByName('T10Total').value) +
Number(ff_getElementByName('FaTotal1').value) +
Number(ff_getElementByName('AzTotal1').value) +
Number(ff_getElementByName('HeTotal1').value) +
Number(ff_getElementByName('FkTotal1').value) +
Number(ff_getElementByName('FaTotal2').value) +
Number(ff_getElementByName('AzTotal2').value) +
Number(ff_getElementByName('HeTotal2').value) +
Number(ff_getElementByName('FkTotal2').value);
}

NOTE: Only thing that you need to change in the code above is to replace nameOfYourForm with the name of your form.

Let me know whether it worked.

Regards,

Mihaela
#234466
The following user(s) said Thank You: rd
Moderators: ForumSupporttomeperica
Time to create page: 0.179 seconds

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

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€

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!

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