This topic is locked

Help Me For Editing Record

5/31/2010 1:04:38 PM
PHPRunner General questions
J
jadliali author

Have a problem, in PHPRunner. There is a three feilds 1 is for id - 2nd is roll number and 3rd is student name. for example if there is no roll number in field 2 then how I can stop the student to edit his name. But if the roll number is there in field 2 the student is now able to edit his name. I am new if any body can help me please e-mail me my e-mail address is jadli_1999@yahoo.com . I shall be thankfull.

A
ann 6/1/2010

Hi,
use custom Javascript code (Add page: Javascript onload Event on the Events tab) to disable student_name field on the fly based on value selected in another field.

Here is a sample:

var tName = 'TableName';

var ctrl1 = Runner.controls.ControlManager.getAt(tName, pageid, 'roll_number');

var ctrl2 = Runner.controls.ControlManager.getAt(tName, pageid, 'student_name');

function func(){

if (ctrl1.getValue()) {

ctrl2.setEnabled()}

else{

ctrl2.setDisabled();}

}

ctrl1.on('change',func);



where roll_number and student_name are actual field names.

J
jadliali author 6/7/2010



Hi,
use custom Javascript code (Add page: Javascript onload Event on the Events tab) to disable student_name field on the fly based on value selected in another field.

Here is a sample:

var tName = 'TableName';

var ctrl1 = Runner.controls.ControlManager.getAt(tName, pageid, 'roll_number');

var ctrl2 = Runner.controls.ControlManager.getAt(tName, pageid, 'student_name');

function func(){

if (ctrl1.getValue()) {

ctrl2.setEnabled()}

else{

ctrl2.setDisabled();}

}

ctrl1.on('change',func);



where roll_number and student_name are actual field names.



__ <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=50355&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

Hi,

Thanks now this code is working but please can I add one more field to disable for example if I want to disable "class" field too how I can add to this code. please help me if you disable one more "class" field then I will be able to understand how to disable more then one fields in above code.
Best regards,
jadliali

A
ann 6/8/2010

Jadliali,
you should add one more control, e.g. ctrl3. Use it in the if-else condition to set Enable or Disable (as it is for ctrl2 in the example).

More information:

http://xlinesoft.com/phprunner/docs/javascript_api.htm