arg() dependent hidden field in AJAX form
As suggested by @AyeshK, I checked the $form_state in the hook_form before i set the value from arg()

 $form['slideid'] = array(
  '#type' =&gt; 'hidden',
  '#value' =&gt; (!empty($form_state['input']['slideid']) ? $form_state['input']['slideid'] : arg(2))
);


This could also be done in the hook_form_submit ...

function hook_form_submit($form, &amp;$form_state){

    if($form_state['values']['slideid'] != $form_state['input']['slideid']){
        $form_state['values']['slideid'] = (int)$form_state['input']['slideid'];
    }
   //====save the form data...

}


It looks like a crude fix, but it works for me.

Thank you for your help @AyeshK &amp; @kiamlaluno