Friday, February 4, 2011

Confirmation Box On Submit

Here is a sample coding for generating Confirm Box on clicking a submit..

  • The form gets submitted only after user approves it.
  • You can just add the following lines of coding as attributes in your form element.
  • If the user clicks on 'NO', the form is not submitted
Important Lines are highligted in red color.

$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
'#attributes' => array('onclick' => ('if(confirm("Are you sure you want to submit the form")) return true; return false')),
);

2 comments:

  1. will you please explain about single sign on concept(general)

    ReplyDelete
  2. soon i will add single sign on concpets too

    ReplyDelete