Delphi For PHP Forums       


Go Back   Delphi-PHP Forums > Programming > PHP - Code
Forum Jump Register FAQ Members List Downloads Search Today's Posts Mark Forums Read

PHP - Code PHP programming - Ask questions and help people with PHP code. If you are stuck and need help, this is where you ask for help.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 8th February 2010, 11:00
D4PHP User
 
Join Date: Jan 2010
Posts: 64
mhmda is on a distinguished road
Unhappy Js and Radiobutton

When I change the value of radiobutton using js, according to the alert messages it changed but visually on the page it still the old value:

I try it in IE8 and Firefox 3.5.7, in firefox I got the 2 alerts,but in IE I got only ONE alert,the first one and then the page refreshs.

function Button1JSClick($sender, $params)
{
?>
alert(document.getElementById("RadioButton1").valu e);
document.getElementById("RadioButton1").value="toy ou";
alert(document.getElementById("RadioButton1").valu e);
return false;
<?php
}

the second alert is: toyou, but on the page nothing changes...

and btw I tried to use 405hp vcl$ function (I copy it to my common.js) but it didn't work, I don't know why...

Last edited by mhmda; 8th February 2010 at 11:05.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 8th February 2010, 17:38
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,271
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

When stuff like that happens you just need to look into the browsers source to see how they built the object.

For whatever reason they used RadioButton1_caption as the id.
So
RadioButton1_caption.innerHTML="toyou";
does what you want.

When you change common.js you need to refresh your cache as external js files are not downloaded all of the time. When I do something to them I actually modify my vcl to change the name in order to force downloads by my users.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 8th February 2010, 20:31
D4PHP User
 
Join Date: Jan 2010
Posts: 64
mhmda is on a distinguished road
Default

I appreciate your effort for helping...
sometimes my question seems to be a basic thing in web world that I should be familiar with.
But this is my first time with web...

findObj('RadioButton1_caption').innerHTML="yes!!!! !!!!!!!!!!!!1";

Did the work for changing the caption of radio button.

I have another question:
in some sites they use js to fill some forms or fields when I did refresh (F5) in the browser the information still there. and in other sites you have to fill again.

How can I do that (to maintain the information even in case the user refresh the page)?

Last edited by mhmda; 8th February 2010 at 20:34.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 9th February 2010, 00:06
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,271
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

AFAIK
In scripts that use the vcl you either have to store it in session (php with or without ajax) or with js keep them in cookies on the users machine and have the onload event load them.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 9th February 2010, 06:28
D4PHP User
 
Join Date: Jan 2010
Posts: 64
mhmda is on a distinguished road
Default

Thank you very mutch, I got it now :-)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 9th February 2010, 15:21
just Joined!
 
Join Date: Feb 2010
Posts: 2
sg27 is on a distinguished road
Default

Hello,
how can i set radiogroup or radiobutton using JS?

Its doesn't work:
findObj("RadioButton1").checked=true;
findObj("RadioGroup1_1").checked=true;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 9th February 2010, 23:06
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,271
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

Those work for me - or are you not having them set back at the server?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 10th February 2010, 07:49
just Joined!
 
Join Date: Feb 2010
Posts: 2
sg27 is on a distinguished road
Default

Thank you for your prompt response.
My problem is caused by something else.
Still looking...

Delphi4php is a very, very good program.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 08:14.




Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 ©2009, Crawlability, Inc.
Copyright © 2004 - 2009, G&J Solutions Ltd. All Rights Reserved. terms of use