This topic is locked

Amending a {$fileld}

11/29/2011 4:49:18 AM
PHPRunner General questions
author

In the visual editor their are {$filed_name_editcontrol} code. Inside this all the information for the drop down, text field etc is held.
Ok I want to add a {$new_link} which then can run an event. My problem is that I could build this in to the templates but the file new link will appear on all fields on the page, I could also amend the visual editor in html mode but if I reset the page I have to then add this {$new_link} back every time
So I wrote the following, but it shows an Array in the text instead of the defendant drop down box. I tried the following (+ lots of variations)
This

$copy_field = $xt->getvar("state_editcontrol");

$copy_field.= "extra info";

$xt->assign("state_editcontrol",$copy_field);
or this
$copy_field = $xt->getvar("state_editcontrol");

array_push($copy_field, "apple");

$xt->assign("state_editcontrol",$copy_field);
Is their a simple way of adding to this edit field some default text that changes based on an event.
Regards
Richard

C
cgphp 11/29/2011

In the "Process record values" event of the edit page, enter the following code:

$values['state'] .= "extra info";
7542 11/29/2011

Hi
I assume that code updates the value posted. I do not want to do that, I need to display different messages or records beside the form fields. I wanted to hijack the

[font="arial, verdana, tahoma, sans-serif"][size="2"][color="#1c2837"]

[/size]
[font="arial, verdana, tahoma, sans-serif"][size="2"][color="#1c2837"]

[/size]
[color=#1C2837][font=arial, verdana, tahoma, sans-serif]

C
cgphp 11/29/2011

Post a screenshot of wat you want to achieve.

7542 11/29/2011

Hi
I do not have any pictures.
All I want to do is avoid having to write {$new_link}, {$new_link2} .... on the visual editor. I would like to update the editcontrol as explained below.
//get the edit control var
//add after the closing </select>

[color=#1C2837]
//Assign the control back with the custom link
[color=#1C2837][font=arial, verdana, tahoma, sans-serif]
[font="arial, verdana, tahoma, sans-serif"][size="2"][color="#1c2837"]

[/size]
[font="arial, verdana, tahoma, sans-serif"][size="2"][color="#1c2837"]

[/size]
[font="arial, verdana, tahoma, sans-serif"][size="2"][color="#1c2837"]

[/size]

7542 11/29/2011

Hi
In short I am trying to add a custom link beside the drop down menu. I guess i just need to use the visual editor and add a {$new_link}.
I wanted to avoid adding all the new links back in when I have to reset the field
Regards
Richard

C
cgphp 11/29/2011

If you want to dinamically show a link when the dropdown value changes you can use javascript.

7542 11/29/2011

Hi
No I do not want to do it dependent of the value changing.
I wish that this code would work
[size="2"]//get the edit control var[/size]

[size="2"]$copy_field = $xt->getvar("state_editcontrol");[/size]
[size="2"]//add after the closing </select>[/size]

[size="2"]$copy_field.="a link to recorlds";[/size]
[size="2"]//Assign the control back with the custom link[/size]

[size="2"]$xt->assign("state_editcontrol",$copy_field);[/size]

Would work. I get a the word Array displayed instead of the drop down menu. i.e "Array followed by the link"
the drop down menu works fine if i do
//get the edit control var

$copy_field = $xt->getvar("state_editcontrol");
//Assign the control back with the custom link$xt->assign("state_editcontrol",$copy_field);[/size]

[color="#1C2837"]

the drop down menu shows the word Array if i add the following line
[color="#1C2837"][font="arial, verdana, tahoma, sans-serif"][size="2"]//add after the closing </select>[/size]
I hoped that their was a simple answer but it does not seem so
Thanks

C
cgphp 11/29/2011

Sorry, it's not very clear for me what you want to do. Could you post or send me (via PM) a demo link ?

S
stiven 11/29/2011

where are you placing this code??



Hi
No I do not want to do it dependent of the value changing.
I wish that this code would work
[size="2"]//get the edit control var[/size]

[size="2"]$copy_field = $xt->getvar("state_editcontrol");[/size]
[size="2"]//add after the closing </select>[/size]

[size="2"]$copy_field.="a link to recorlds";[/size]
[size="2"]//Assign the control back with the custom link[/size]

[size="2"]$xt->assign("state_editcontrol",$copy_field);[/size]

Would work. I get a the word Array displayed instead of the drop down menu. i.e "Array followed by the link"
the drop down menu works fine if i do
//get the edit control var

$copy_field = $xt->getvar("state_editcontrol");
//Assign the control back with the custom link$xt->assign("state_editcontrol",$copy_field);[/size]

[color="#1C2837"]

the drop down menu shows the word Array if i add the following line
[color="#1C2837"][font="arial, verdana, tahoma, sans-serif"][size="2"]//add after the closing </select>[/size]
I hoped that their was a simple answer but it does not seem so
Thanks

7542 11/29/2011

Before Display event. Thanks

C
cgphp 11/29/2011

Try this:

$copy_field = $xt->fetchVar("state_editcontrol");

$copy_field .= "extra info";

$xt->assignbyref("state_editcontrol",$copy_field);