Foros del Web » Programando para Internet » Javascript »

Problema calendario submit

Estas en el tema de Problema calendario submit en el foro de Javascript en Foros del Web. Hola buenas tardes, resulta que tengo un calendario emergente que sirve para poner la fecha en un campo de texto y de ahi pones enviar ...
  #1 (permalink)  
Antiguo 12/05/2010, 08:36
 
Fecha de Ingreso: mayo-2010
Mensajes: 7
Antigüedad: 13 años, 11 meses
Puntos: 0
Problema calendario submit

Hola buenas tardes,

resulta que tengo un calendario emergente que sirve para poner la fecha en un campo de texto y de ahi pones enviar y se envia la fecha y muestra los datos correspondientes a esa fecha, pero me gustaria modificar y que no se tubiera que dar en el boton de enviar, simplemente haciendo click sobre la fecha del calendario hiciese el submit y mostrara los datos de ese dia. Si alguien tiene alguna idea de como hacerlo se agredeceria,muchas gracias.
  #2 (permalink)  
Antiguo 12/05/2010, 08:46
Avatar de David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
Respuesta: Problema calendario submit

Eso no es problema de PHP, sino de Javascript. ¿Qué script utilizas para el calendario?
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.
  #3 (permalink)  
Antiguo 12/05/2010, 09:25
 
Fecha de Ingreso: mayo-2010
Mensajes: 7
Antigüedad: 13 años, 11 meses
Puntos: 0
Respuesta: Problema calendario submit

Esta es la funcion principal del calendario, luego hay muchas mas pero son 900 lineas de codigo...


Código PHP:
Ver original
  1. function Epoch(name,mode,targetelement,multiselect)
  2. {
  3.   this.state = 0;
  4.   this.name = name;
  5.   this.curDate = new Date();
  6.   this.mode = mode;
  7.   this.selectMultiple = (multiselect == true); //'false' is not true or not set at all
  8.  
  9.   //the various calendar variables
  10.   //this.selectedDate = this.curDate;
  11.   this.selectedDates = new Array();
  12.   this.calendar;
  13.   this.calHeading;
  14.   this.calCells;
  15.   this.rows;
  16.   this.cols;
  17.   this.cells = new Array();
  18.  
  19.   //The controls
  20.   this.monthSelect;
  21.   this.yearSelect;
  22.  
  23.   //standard initializations
  24.   this.mousein = false;
  25.   this.calConfig();
  26.   this.setDays();
  27.   this.displayYear = this.displayYearInitial;
  28.   this.displayMonth = this.displayMonthInitial;
  29.  
  30.   this.createCalendar(); //create the calendar DOM element and its children, and their related objects
  31.  
  32.   if(this.mode == 'popup' && targetelement && targetelement.type == 'text') //if the target element has been set to be an input text box
  33.   {
  34.     this.tgt = targetelement;
  35.     this.calendar.style.position = 'absolute';
  36.     this.topOffset = this.tgt.offsetHeight; // the vertical distance (in pixels) to display the calendar from the Top of its input element
  37.     this.leftOffset = 0;           // the horizontal distance (in pixels) to display the calendar from the Left of its input element
  38.     this.calendar.style.top = this.getTop(targetelement) + this.topOffset + 'px';
  39.     this.calendar.style.left = this.getLeft(targetelement) + this.leftOffset + 'px';
  40.     document.body.appendChild(this.calendar);
  41.     this.tgt.calendar = this;
  42.     this.tgt.onfocus = function () {this.calendar.show();}; //the calendar will popup when the input element is focused
  43.     this.tgt.onblur = function () {if(!this.calendar.mousein){this.calendar.hide();}}; //the calendar will popup when the input element is focused
  44.   }
  45.   else
  46.   {
  47.     this.container = targetelement;
  48.     this.container.appendChild(this.calendar);
  49.   }
  50.  
  51.   this.state = 2; //0: initializing, 1: redrawing, 2: finished!
  52.   this.visible ? this.show() : this.hide();
  53. }




y aqui es cuando lo quiero llamar en la hoja php


<script type="text/javascript">
{literal}
var bas_cal,dp_cal,ms_cal;
window.onload = function () {
dp_cal = new Epoch('epoch_popup','popup',document.getElementByI d('popup_container'));

};
</script>


Gracias!
  #4 (permalink)  
Antiguo 12/05/2010, 09:28
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Tema movido desde PHP a Javascript
  #5 (permalink)  
Antiguo 12/05/2010, 12:04
Avatar de David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
Respuesta: Problema calendario submit

¿El script tiene alguna documentación? ¿De dónde lo obtuviste? ¿Dispara algún evento a la hora de seleccionar la fecha?
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.
  #6 (permalink)  
Antiguo 13/05/2010, 08:01
 
Fecha de Ingreso: mayo-2010
Mensajes: 7
Antigüedad: 13 años, 11 meses
Puntos: 0
Respuesta: Problema calendario submit

Cita:
Iniciado por David Ver Mensaje
¿El script tiene alguna documentación? ¿De dónde lo obtuviste? ¿Dispara algún evento a la hora de seleccionar la fecha?



La verdad que la aplicacion me la he encontrado tal cual y me han dicho de mejorarla, asi que no tengo mucha documentacion...
Cuando haces click en el campo de texto se abre una ventana pequeña de un calendario que al hacer click sobre una fecha se escribe en el campo de texto y luego hay otro boton que hace de submit.

Lo que quiero hacer es que cuando hagas click directamente sobre el calendario canvie la fecha sin tener que hacer click al otro boton. Nose si me explico, si no se entiende pongo foto..

Gracias!
  #7 (permalink)  
Antiguo 13/05/2010, 10:21
Avatar de David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
Respuesta: Problema calendario submit

Se entiende, pero sin ver el script del calendario es difícil decirte qué hay que modificar.

Busca la parte del script que modifica el targetelement (this.tgt, el input) y allí envías el formulario.
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.
  #8 (permalink)  
Antiguo 13/05/2010, 11:08
 
Fecha de Ingreso: mayo-2010
Mensajes: 7
Antigüedad: 13 años, 11 meses
Puntos: 0
Respuesta: Problema calendario submit

Cita:
Iniciado por David Ver Mensaje
Se entiende, pero sin ver el script del calendario es difícil decirte qué hay que modificar.

Busca la parte del script que modifica el targetelement (this.tgt, el input) y allí envías el formulario.


Aqui me sale un targetelement tal como dices...


Código Javascript:
Ver original
  1. if(this.mode == 'popup' && targetelement && targetelement.type == 'text') //if the target element has been set to be an input text box
  2.   {
  3.     this.tgt = targetelement;
  4.     this.calendar.style.position = 'absolute';
  5.     this.topOffset = this.tgt.offsetHeight; // the vertical distance (in pixels) to display the calendar from the Top of its input element
  6.     this.leftOffset = 0;           // the horizontal distance (in pixels) to display the calendar from the Left of its input element
  7.     this.calendar.style.top = this.getTop(targetelement) + this.topOffset + 'px';
  8.     this.calendar.style.left = this.getLeft(targetelement) + this.leftOffset + 'px';
  9.     document.body.appendChild(this.calendar);
  10.     this.tgt.calendar = this;
  11.     this.tgt.onfocus = function () {this.calendar.show();}; //the calendar will popup when the input element is focused
  12.     this.tgt.onblur = function () {if(!this.calendar.mousein){this.calendar.hide();}}; //the calendar will popup when the input element is focused
  13.   }
  14.   else
  15.   {
  16.     this.container = targetelement;
  17.     this.container.appendChild(this.calendar);
  18.   }
  #9 (permalink)  
Antiguo 13/05/2010, 12:43
Avatar de David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
Respuesta: Problema calendario submit

No, no me refiero a esa parte. Me refiero a cuando seleccionas un día y cambia el value del elemento con la fecha elegida.
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.
  #10 (permalink)  
Antiguo 27/05/2010, 10:03
 
Fecha de Ingreso: mayo-2010
Mensajes: 7
Antigüedad: 13 años, 11 meses
Puntos: 0
Respuesta: Problema calendario submit

Es el unico target element this.tgt que me aparece...weno he visto y hay otro, pero no hay mas..


Epoch.prototype.resetSelections = function (returnToDefaultMonth) //PRIVATE: reset the calendar's selection variables to defaults
{
this.selectedDates = new Array();
this.rows = new Array(false,false,false,false,false,false,false);
this.cols = new Array(false,false,false,false,false,false,false);
if(this.tgt) //if there is a target element, clear it too
{
this.tgt.value = '';
if(this.mode == 'popup') {//hide the calendar if in popup mode
this.hide();
}
}

if(returnToDefaultMonth == true) {
this.goToMonth(this.displayYearInitial,this.displa yMonthInitial);
}
else {
this.reDraw();
}
};

Última edición por carlorodri; 27/05/2010 a las 10:09

Etiquetas: calendario, submit
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 17:25.