Input does not appear echo

Asked

Viewed 148 times

0

When I echo an input value of this serviceOrderForm.php file loaded via ajax, the correct content appears in the Browse code, but nothing printed in the input (in any input with echo). Has anyone been through this? I call via Ajax as follows:

$('#form').load('../serviceOrder/serviceOrderForm.php');

However it only does not work when it is a form for new registration, when this same form is called by the button to edit bringing the Mysql data, the inputs with Excerpts all work, either with database data or printing only the date..

Could Ajax have something to do with it?

My input code:

<input type="date" class="form-control" name="dateRegister" id="dateRegister" value="<?php echo date('Y-m-d'); ?>" readonly>

My Ajax code that calls the form (where it displays the Echos in the form.php), triggered by clicking the Edit button:

function insertDataEditForm(_id, _url){
  $.ajax({
    type: 'POST',
    url: _url,
    data: {code: _id},
    success: function(data){
      /* Aqui o form exibe os echos*/
      $("#form").html(data);
      console.log('insertDataEditForm');
    }
  });
  return false;
};

My Ajax code that chooses the page to be loaded (where it does not display the Snippets in the form.php), triggered by clicking on a menu category.

function choosePage(href) {
  console.log(href);
  switch (href) {
    case '../client/clientMain.php':
      area = '../client/client';
      refreshList(area+'List.php');
      searchInputs();
      $('#form').load(area+'Form.php');
      break;
    case '../vehicle/vehicleMain.php':
      area = '../vehicle/vehicle';
      refreshList(area+'List.php');
      searchInputs();
      $('#form').load(area+'Form.php');
      break;
    case '../serviceOrder/serviceOrderMain.php':
      area = '../serviceOrder/serviceOrder';
      refreshList(area+'List.php');
      searchInputs();
      /* Aqui o form nao exibe os echos*/
      $('#form').load(area+'Form.php');
      break;
   }
}

There’s nothing in css that might be interfering, I’m using 99% of Bootstrap’s css. And there is no error, neither in the browser console nor in the php pages.

To summarize: When I call a form via Ajax to perform a new registration, the entries in the input value do not appear, although they are displayed in the browser’s html code. And when that same form is called by the button "edit" everything works perfectly.

Print do codigo browser

  • You don’t have any code in javascript that might be deleting the fields.

  • There is no mask?

  • Have you tried changing the date format on echo date('Y/m/d')?

  • goes up in Jsfiddle or something similar, to be clearer

  • 1

    @Panda Caraca guy, that’s right. Thank you very much!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.