Bienvenido, Invitado
Recordarme

TEMA:

Checkbox nur anwählbar, wenn Datum in Zukunft 4 meses 1 semana antes #261872

  • Autor del tema
  • Mehmet
  • Fuera de línea
  • Fresh Breezer
  • Fresh Breezer
  • Mensajes: 12
  • Gracias recibidas: 0
Hallo Leute,

hab da ein Problem, ich möchte ein Checkbox einrichten, die nur an klick bar ist wenn das Datum in Zukunft liegt, also Morgen zum Beispiel.
Hat da jemand eine Idee.

Gruß
Mehmet

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Checkbox nur anwählbar, wenn Datum in Zukunft 4 meses 1 semana antes #261896

  • Avatar de Mirec
  • Mirec
  • Ausente
  • Ultimate Breezer
  • Ultimate Breezer
  • Mensajes: 1370
  • Karma: 2
  • Gracias recibidas: 74
Hi,

I hope that we can continue with England language! :)

I do not understand the well question, could you please explain it a little better and I will help you!

As I understand I make one example of how should look it.
Please download->unzip->and install it (BF->Configuration->Package Installer->select this xml file->Install Package).

In Advenced of Form->Scripts->Init script you can find code this:
function ff_mirko0000_init()
{

setInterval('test()', 500);

} // ff_QuickForm972683687_init

function test(){
var f =ff_getElementByName('b').value;
var h =ff_getElementByName('c').value;

if(f > h){
jQuery(document).ready(function(){

jQuery("#ff_elem6335").attr("disabled", true);
});


}
else{
jQuery("#ff_elem6335").attr("disabled", false);

}
}
In field Current date in propertis i section value I added current dates.
<?php return date('Y-m-d');?>


Explanation of code:

1)function ff_mirko0000_init()
instead 'mirko0000' insert name of your form.

2)jQuery("#ff_elem6335").attr("disabled", true); instead 'ff_elem6335' you need add id of checkbox, you need make inspect in console and find 'id' of checkbox.(not id lable of checkbox then id of checkbox)


An example you have three fields, one Checkbox and Current Date which is a hidden field (In Advanced of element I turn off element that you can not see the element in frontend), and Calendar, if you select in the calendar above the date of the current you will not check the box otherwise you can do it.

Please test it and let me know the result!
If you get stuck, let me know!

Regards,
Mirko
Adjuntos:

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Última Edición: Post by Mirec.

Checkbox nur anwählbar, wenn Datum in Zukunft 4 meses 6 días antes #261909

  • Autor del tema
  • Mehmet
  • Fuera de línea
  • Fresh Breezer
  • Fresh Breezer
  • Mensajes: 12
  • Gracias recibidas: 0
Hello Mirko,
I'll try an English translation.
I have a homepage: Wochenplan (mensa-whgneuwied.de)
with a form.
if you click on the checkbox e.g. Monday, further input fields appear to be filled out.
But I would like the checkbox: Monday only to Sunday 4:00 p.m. to be clickable, otherwise it is deactivated.
Checkbox: Tuesday, then only until Monday 4 p.m. and so on.

Another question:
I also found a date validation YYYY-MM-DD in the forum, but I want one with DD-MM-YYYY, how do I do that.
Greetings from Neuwied, Germany
Mehmet

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Checkbox nur anwählbar, wenn Datum in Zukunft 4 meses 6 días antes #261913

  • Avatar de Mirec
  • Mirec
  • Ausente
  • Ultimate Breezer
  • Ultimate Breezer
  • Mensajes: 1370
  • Karma: 2
  • Gracias recibidas: 74
Hi,

But I would like the checkbox: Monday only to Sunday 4:00 p.m. to be clickable, otherwise, it is deactivated.
Checkbox: Tuesday, then only until Monday 4 p.m. and so on.


Ok, I figure out what you want and I made one example of how it should work and I sent an example in the attached file, Please download->unzip->and install it (BF->Configuration->Package Installer->select this xml file->Install Package).



You can find code in Scripts->Init script :
function ff_mirko0000_init()
{

setInterval('test()', 500);

} // ff_QuickForm972683687_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);
}

}

}

- jQuery("#ff_elem6335").attr("disabled", true); instead 'ff_elem6335' you need add id of checkbox, you need make inspect in console and find 'id' of checkbox.(not id lable of checkbox then id of checkbox)

In my example, I added yet one element that fetching current time, you can find code in properties of the element in section 'value'.

When you select a date in the element calendar (not longer than 7 days) and current time, not after 16h, you can enable the checkbox otherwise you can not do it.

I also found a date validation YYYY-MM-DD in the forum, but I want one with DD-MM-YYYY, how do I do that.

you can do it, GO in properties of your element, and find field 'format' and insert this format
"%d-%m-%Y "

I hope I explained a well!
If you get stuck, let me know!
Regards,
Mirko
Adjuntos:

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Última Edición: Post by Mirec.

Checkbox nur anwählbar, wenn Datum in Zukunft 4 meses 5 días antes #261948

  • Autor del tema
  • Mehmet
  • Fuera de línea
  • Fresh Breezer
  • Fresh Breezer
  • Mensajes: 12
  • Gracias recibidas: 0
Hi Mirko,

unfortunately your link does not work
greeting
Mehmet

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Checkbox nur anwählbar, wenn Datum in Zukunft 4 meses 5 días antes #261951

  • Avatar de Mirec
  • Mirec
  • Ausente
  • Ultimate Breezer
  • Ultimate Breezer
  • Mensajes: 1370
  • Karma: 2
  • Gracias recibidas: 74
Hi,

did you find the 'id' of the checkbox as is described in the above comment?
I just tested it on my server and everything works well.

Regards,
Mirko

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Tiempo de carga de la página: 0.047 segundos