Page 1 of 1

Validation not working

Posted: 2013-07-27 04:11
by shkdxb
hello,

I am trying to block updates to records if "UpdateAllowed" field contains "No" as value.
I have inserted the code inside PHP file common.js.php under "function MainTable_validateData()" after all validation commands,but the code is not working. Don't know why. any help?

Code: Select all

if($('UpdateAllowed').value=='No'){
Modalbox.show('<div class="Error" style="width: 90%; margin: 0;">You can\'t Update anymore!</div>',
        {
            title: "Update Blocked!",
            afterHide: function(){ $('UpdateAllowed').focus(); }
        }
    );
    
    /* returning false stops form submission */
    return false;
};

Re: Validation not working

Posted: 2013-08-13 17:22
by shkdxb
no one can help??

Re: Validation not working

Posted: 2013-08-15 03:32
by shkdxb
i tries to do this in different way now

inserted the code below in function MainTable_update($selected_id) in file MainTable_dml.php.

Code: Select all

if($data['UpdateAllowed']=='No'){
		echo StyleSheet() . "\n\n<div class=\"Error\">{$Translation['error:']} 'Update not Allowed':No more updates allowed for this record!! already blocked for updates.<br /><br />";
		echo '<a href="" onclick="history.go(-1); return false;">'.$Translation['< back'].'</a></div>';
		exit;
this works if the field "UpdateAllowed" is not Read only. if i make this field read only, this is not working.

pl pl someone help.