By prodit96 on
i wrote this module to update an existing form with a field that indicate the time with ajax
this is my "test.module"
function test_form_alter(&$form, $form_state, $form_id)
{
if ($form_id=="webform_client_form_9")
{
$form['time'] = array(
'#type' => 'textfield',
'#title' => t('time'),
);
}
drupal_add_js(drupal_get_path('module', 'test') .'/test.js');
}
this is my "test.js"
function changeHeure() {
jQuery.get("getTime.php", {}, reponseServeur);
}
function reponseServeur(texte, erreur, requete) {
$("#edit-time").html(texte);
setTimeout(changeHeure, 1000);
alert("hello");
}
function initializePage() {
changeHeure();
}
$(initializePage);
and this is getTime.php
print date('h:i:s');
i dont know where is the probleme
i have the time field in the form but there is no time in
edit-time is the id of the field when il see the source html of the page of the form
any idea? thanks a lot
Comments
how about changing
how about changing $("#edit-time").html(texte); to $("#edit-time").attr('value', texte); ?
thanks but it doesn't work
thanks
but it doesn't work