Client Script for addopt pages

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
ikikarefarki
User
Posts: 4

Client Script for addopt pages

Post by ikikarefarki »

Hi all,

On the addopt pages (like contactaddopt.php), is it possible to add client script for it in PhpMaker ?


mobhar
User
Posts: 11703

Post by mobhar »

Yes, it is. You may use "Client Script" and "Startup Script" that belongs to the "Add/Copy Page". In other words, those script will be executed also for both addopt and Add pages.


ikikarefarki
User
Posts: 4

Post by ikikarefarki »

Thanks but nope, still not working.

Here is my codes;

$(document).ready(function(){
var type="<?php echo $type;?>";
if(type=="1"){
$("#x_tip").val(2);
}else{
$("#x_tip").val(1);
}
alert(type);
});

I have a field with lookup table, that uses different table and have allow add option. So when users adding a new contact to that field, i need to change "x_tip" field value. That codes working when i adding manually in addopt.php pages. But i cant find where need to write in PhpMaker.


ikikarefarki
User
Posts: 4

Post by ikikarefarki »

Ok, i find an another solution.

I wrote this codes in Row_Rendered function;

$type=$_GET['type'];
if($type==2){
$this->tip->EditValue = "2";
echo "<script type='text/javascript'>alert('$type');</script>";
}else{
$this->tip->EditValue = "1";
echo "<script type='text/javascript'>alert('$type');</script>";
}

I can get "$type" and alert is working fine. But i couldn't change the "tip" fields value. By the way "tip" field is a select box.

How can i change the selectbox selecting value ?


ikikarefarki
User
Posts: 4

Post by ikikarefarki »

I used "CurrentValue" instead of "EditValue" and its done. Works fine.

Sorry for the flood messages.

Thanks again.


Post Reply