TOPIC:

Checkbox nur anwählbar, wenn Datum in Zukunft 1 month 1 week ago #262377

  • Topic Author
  • Mehmet
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 12
  • Thanks: 0
Hi,
how do I get it so that the checkbox is only displayed when the date is entered in the calendar.
So only visible when the date

Please Log in or Create an account to join the conversation.

Checkbox nur anwählbar, wenn Datum in Zukunft 1 month 1 week ago #262381

  • Mirec's Avatar
  • Mirec
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 957
  • Karma: 2
  • Thanks: 50
Hi,

I created an example for you and sent it in attached file, please download->unzip->and install it (BF->Configuration->Package Installer->select this xml file->Install Package).

you can find the code init script and Advanced of Form in the visible rules.

Init script:
function ff_QuickForm1660825328_init()
{
setInterval('test()', 500);
} // ff_QuickForm1660825328_init

function test(){

jQuery('#ff_elem9020').change(function() {
    if(jQuery('#ff_elem9020').val() != ""){
    bfToggleFields("on","element","bfQuickMode3670667",bfDeactivateField);

}else{
    bfToggleFields("off","element","bfQuickMode3670667",bfDeactivateField);

}
});
}

-jQuery('#ff_elem9020').change(function() -> instead ff_elem9020 insert id of your calendar element (please use inspect in console)

-bfToggleFields("on","element","bfQuickMode3670667",bfDeactivateField); -> Instead bfQuickMode3670667 insert name of your checkbox (not title).

visible rules:
 turn on element mydummy if yourdummy is something

This code in visible rules should be the same, do not change anything.

Note. Please in end, turn off the element checkbox in the advanced option.

Let me know the result!
Regards,
Mirko
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: Post by Mirec.

Checkbox nur anwählbar, wenn Datum in Zukunft 1 month 2 days ago #262676

  • Topic Author
  • Mehmet
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 12
  • Thanks: 0
Hallo Mirko,
habe es jetzt erst ausprobiert, alles Super, du bist der Beste, nur wie kann ich 2 funktionen einbinden?
Gruß
Mehmet
z.B.


function ff_Wochenplan_init()
{
setInterval('test()', 500);
} // ff_Wochenplan_init

function test(){

jQuery('#ff_elem9020').change(function() {
if(jQuery('#ff_elem9020').val() != ""){
bfToggleFields("on","element","1",bfDeactivateField);

}else{
bfToggleFields("off","element","1",bfDeactivateField);

}
});
}

AND

function ff_Wochenplan_init()
{

setInterval('test()', 500);

} // ff_Wochenplan_init

function test(){
var selecteddate =ff_getElementByName('b').value;
var currentdate=ff_getElementByName('c').value;
var time =ff_getElementByName('d').value;

if(time > 16 ){
jQuery("#ff_elem6335").attr("disabled", true);
}
else{
jQuery("#ff_elem6335").attr("disabled", false);
if(selecteddate > currentdate){
jQuery("#ff_elem6335").attr("disabled", true);
}else{
jQuery("#ff_elem6335").attr("disabled", false);
}

}

}

Please Log in or Create an account to join the conversation.

Checkbox nur anwählbar, wenn Datum in Zukunft 1 month 2 days ago #262677

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 6926
  • Karma: 3
  • Thanks: 493
Hi,

you can integrate it like this:
function ff_Wochenplan_init()
{
setInterval('test()', 500);
setInterval('test1()', 500);

} // ff_Wochenplan_init

function test(){

jQuery('#ff_elem9020').change(function() {
if(jQuery('#ff_elem9020').val() != ""){
bfToggleFields("on","element","1",bfDeactivateField);

}else{
bfToggleFields("off","element","1",bfDeactivateField);

}
});
}



function test1(){
var selecteddate =ff_getElementByName('b').value;
var currentdate=ff_getElementByName('c').value;
var time =ff_getElementByName('d').value;

if(time > 16 ){
jQuery("#ff_elem6335").attr("disabled", true);
}
else{
jQuery("#ff_elem6335").attr("disabled", false);
if(selecteddate > currentdate){
jQuery("#ff_elem6335").attr("disabled", true);
}else{
jQuery("#ff_elem6335").attr("disabled", false);
}

}

}

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Checkbox nur anwählbar, wenn Datum in Zukunft 3 weeks 4 days ago #262923

  • Topic Author
  • Mehmet
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 12
  • Thanks: 0
Hi my calendar has the format %d.%m.%Y now I want a validation that does not put the date in the past outputs an error message such as e.g. ValidateNotPast found a script but it doesn't work:

function ff_validate_date_DDMMYYYY(element, message)
{
// Regular expression used to check if date is in correct format
var pattern = /[0-3][0-9]\/(0|1)[0-9]\/(19|20)[0-9]{2}/;
if(pattern.test(element.value))
{
var date_array = element.value.split('/');
var day = date_array[0];

// Attention! Javascript consider months in the range 0 - 11
var month = date_array[1] - 1;
var year = date_array[2];

// This instruction will create a date object
source_date = new Date(year,month,day);

if(year != source_date.getFullYear())
{
return message == '' ? 'Element ' + element.name + ' failed my test' : message;
}

if(month != source_date.getMonth())
{
return message == '' ? 'Element ' + element.name + ' failed my test' : message;
}

if(day != source_date.getDate())
{
return message == '' ? 'Element ' + element.name + ' failed my test' : message;
}
}
else
{
return message == '' ? 'Element ' + element.name + ' failed my test' : message;
}

return '';
}

Please Log in or Create an account to join the conversation.

Checkbox nur anwählbar, wenn Datum in Zukunft 3 weeks 4 days ago #262924

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 6926
  • Karma: 3
  • Thanks: 493
Hi,

please go to your calendar -> properties-> and as a Format put:
%d.%m.%Y
Then go to calendar->Propertis->Validation->check Custom and put:
function ff_calendar2_validation(element, message)
{
    // Checking if the entered date is in right format
   var pattern =  /[0-3][0-9]\.(0|1)[0-9]\.(19|20)[0-9]{2}$/;
   if(pattern.test(element.value))
   {
      var date_array = element.value.split('.');
      var day = date_array[0];
 
      // Attention! Javascript consider months in the range 0 - 11
      var month = date_array[1] - 1;
      var year = date_array[2];
 
      // This instruction will create a date object
      var startDate = new Date(year,month,day);
 }
    
   var today = new Date();
 
     today.setHours(0);
     today.setMinutes(0);
     today.setSeconds(0);
     today.setMilliseconds(0);
     today = today.getTime();
 
     if(startDate < today)
     {
          if (message=='') message = element.name+" date can't be in past.n";
          return message;
     }
     return '';
} // ff_calendar2_validation
Please replace calendar2 with name of your calendar (not title)

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Time to create page: 0.052 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

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!