This topic is locked

button caption

7/6/2011 5:16:41 AM
PHPRunner General questions
R
rocknroll_france author

Hi,

Is there a way to change the caption of a custom button ragarding a $_session value ?
example

$_session('variable'] = 1 then Caption button = "Hello"

$_session('variable'] = 0 then Caption button = "Bye"
Thanks for help

C
cgphp 7/6/2011

Read this before:
http://xlinesoft.com/phprunner/docs/how_to_access_php_variables.htm
Then, with javascript, you can change the button caption.

R
rocknroll_france author 7/7/2011

Hi Christian,

May be I don't explain clearly <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=59295&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />
I have the variable soon registered in $_SESSION (I need it on all the forms...)
what I need is the syntax for the "caption" name...

something as: ctrl.caption("NameOfControl") = "Hello World";
At this time, I've the following code in HTML view:

<INPUT id=Actives class=button value=Couples&nbsp;ACTIFS&nbsp;/&nbsp;NON&nbsp;ACTIFS type=button typeid="ib">
Hum...... I just paste the code and see that the "word" is not "caption", but "value"....

so I think that the good syntax is ctrl.value("NameOfControl").

May be the name is "Actives" ???? ==> ctrl.value("Actives")???

Or should I add: Name = "A_name" so the good syntax will be : ctrl.value("A_Name")???

C
cgphp 7/8/2011

I see what you mean.
If you want to achieve this:

$_SESSION['variable'] = 1 then Caption button = "Hello"

$_SESSION['variable'] = 0 then Caption button = "Bye"


you have to pass the new "caption" var to javascript using the instructions reported at this link: http://xlinesoft.com/phprunner/docs/how_to_access_php_variables.htm
Then you can change the label button in the Javascript OnLoad event:

$("input[id='Actives']").attr("values",caption);
R
rocknroll_france author 7/8/2011

Thanks Cristian,

Not the time to test now.

I'll try and come back if needed.

Have a nice WE