Question: Prevent Date Picker And Select

Prevent Date Picker And Select

I want to be able to make Date, Due Date, and Customer fields "readonly" during the Add Invoice process. (Customer is given a default value at entry, but this can be changed by admin later i

SS

Scott Smith

Asked
I want to be able to make Date, Due Date, and Customer fields "readonly" during the Add Invoice process. (Customer is given a default value at entry, but this can be changed by admin later if necessary.)

I know the HTML readonly attribute isn't the right answer. It makes the field dimmed, but does not prevent the date picker from being used. Nor does it prevent the use of the Customer select. And the disabled attribute is obviously not the answer as disabled fields aren't POSTed.

What is the right way to make these readonly and deactivate the picker and select fields?
  • MS

    Mian Saleem

    Answered
    Hello,

    To disable the date picker, you can remove the `date` & `datetime` class/id of input.

    For select `chosen` is used, you can update the code `$('form select').chosen({` to `$('form select').not('.skip').chosen({` and then add `skip` class to the select.

    OR you can disabled them and have hidden input as replacement.

    Anything on the front end is not really secure, anyone with little html knowledge can fake the data. The secure solution should be to not use these filed at server but to use the assigned one. The `process_form` method of the `app/models/Sales_model.php` is responsible to prepare data.

    Thank you
  • Login to Reply