0

I need to make a form read-only under certains conditions : what I did is to not add the $form['submit'] button.

This way I can't submit the form. But I wonder if it is enough ...

Do you know if I ca be 100% sure that nobody could find a way to submit the form ?

Thanks !

1

You can set #executes_submit_callback as FALSE

eg : $form['submit']['#executes_submit_callback'] = FALSE;

Drupal Document is here

1

To make sure nobody submit the form create a custom validate function that always set error on form ,(using form_set_error).

In that validate function you have to check for the circunstnaces that makes the form available to submission or not.

  • Hi there, thanks for the simple tip ... Ill mix both : not having a submit button and adding a global validation function – Math666 Jan 9 '15 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.