FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » checkbox own set and reload page
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
checkbox own set and reload page [message #170541] Sun, 07 November 2010 10:18 Go to next message
anver is currently offline  anver
Messages: 5
Registered: November 2010
Karma: 0
Junior Member
a page with inner

function A(){

there is a checkbox
}


function B(){

unset(variable) or other code;

}

When page is loaded the check is off and is applied the code in B

I would like, for every click on check, to apply or not the code B,
and that check remain in the selction made;
selction achived not on server but in the pc because it is a form's check
used by other user, so not a global set
Re: checkbox own set and reload page [message #170542 is a reply to message #170541] Sun, 07 November 2010 10:52 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
anver wrote:
> a page with inner
>
> function A(){
>
> there is a checkbox
> }
>
>
> function B(){
>
> unset(variable) or other code;
>
> }
>
> When page is loaded the check is off and is applied the code in B
>
> I would like, for every click on check, to apply or not the code B,
> and that check remain in the selction made;
> selction achived not on server but in the pc because it is a form's check
> used by other user, so not a global set

Try a course in writing comprehensible english, then javascript,.
Re: checkbox own set and reload page [message #170545 is a reply to message #170542] Sun, 07 November 2010 12:23 Go to previous messageGo to next message
sheldonlg is currently offline  sheldonlg
Messages: 166
Registered: September 2010
Karma: 0
Senior Member
On 11/7/2010 5:52 AM, The Natural Philosopher wrote:
> anver wrote:
>> a page with inner
>>
>> function A(){
>>
>> there is a checkbox
>> }
>>
>>
>> function B(){
>>
>> unset(variable) or other code;
>> }
>>
>> When page is loaded the check is off and is applied the code in B
>>
>> I would like, for every click on check, to apply or not the code B,
>> and that check remain in the selction made;
>> selction achived not on server but in the pc because it is a form's check
>> used by other user, so not a global set
>
> Try a course in writing comprehensible english, then javascript,.

Agreed, but OP's native language is most likely not English and he is
trying his best to describe his problem in English. So, give him a
break since he is doing the best he can.

As I understand it, here is what he means -- and anver correct me if I
am wrong.

On his form he has a checkbox.
When the user checks this checkbox, he wants something done, namely to
run function B and do things.
When the user unchecks this checkbox, he doesn't want to do things.

So, the simplest way is to have a Javascript function which does the
following:

function newFunction() {
-- test on whether checked or not.
-- if not checked then return
-- if checked then do what he wants done in function B or call
function B
}

Now I am not sure what he wants as far as written to the PC, but I think
he may be able to accomplish what he wants via a cookie. As far as I
know, that is the only thing that can be written to the PC without a
user's explicit permission (and even that requires that cookies be
allowed by the user).

In any event, anver, you should take your question to
comp.lang.javascript as there is nothing in it having to do with php and
there you will find better help.

--
Shelly
Re: checkbox own set and reload page [message #170546 is a reply to message #170545] Sun, 07 November 2010 12:53 Go to previous messageGo to next message
anver is currently offline  anver
Messages: 5
Registered: November 2010
Karma: 0
Junior Member
> As I understand it, here is what he means -- and anver correct me if I
> am wrong.
>
> On his form he has a checkbox.
> When the user checks this checkbox, he wants something done, namely to
> run function B and do things.

ok run a code B1 inner function B

> When the user unchecks this checkbox, he doesn't want to do things.

ok not more run code B1 inner function B (or run other code B2)



> So, the simplest way is to have a Javascript function which does the
> following:
>
> function newFunction() {
> -- test on whether checked or not.
> -- if not checked then return
> -- if checked then do what he wants done in function B or call
> function B
> }

ok is necessary javascript;
steps are this
when page is loaded check is off (default) and run function B and its code
B;
if a user click on the check, is necessary to reload the page for run
function B and code B2;





> Now I am not sure what he wants as far as written to the PC,


simple:
if php or js achieved the value of check inner a db or server, oneother
user that use the same form will have the set of the first user; this isn't
correct;


thanks
Re: checkbox own set and reload page [message #170547 is a reply to message #170546] Sun, 07 November 2010 16:15 Go to previous message
sheldonlg is currently offline  sheldonlg
Messages: 166
Registered: September 2010
Karma: 0
Senior Member
On 11/7/2010 7:53 AM, anver wrote:
>> As I understand it, here is what he means -- and anver correct me if I
>> am wrong.
>>
>> On his form he has a checkbox.
>> When the user checks this checkbox, he wants something done, namely to
>> run function B and do things.
>
> ok run a code B1 inner function B
>
>> When the user unchecks this checkbox, he doesn't want to do things.
>
> ok not more run code B1 inner function B (or run other code B2)
>
>
>
>> So, the simplest way is to have a Javascript function which does the
>> following:
>>
>> function newFunction() {
>> -- test on whether checked or not.
>> -- if not checked then return
>> -- if checked then do what he wants done in function B or call
>> function B
>> }
>
> ok is necessary javascript;
> steps are this
> when page is loaded check is off (default) and run function B and its code
> B;
> if a user click on the check, is necessary to reload the page for run
> function B and code B2;

The function above is a javascript function. No need to reload the
page, however you can do that if you want to. Otherwise, innerHTML does
the job.

>
>
>
>
>
>> Now I am not sure what he wants as far as written to the PC,
>
>
> simple:
> if php or js achieved the value of check inner a db or server, oneother
> user that use the same form will have the set of the first user; this isn't
> correct;

I think you need to find someone who speaks your language and better
English and have them compose the post for you. I simply cannot
understand what you are trying to say or do. Sorry.

However, I will say this much:
php only gets the value one of three ways:
1 - the form is submitted and it gets the value of the checkbox (checked
or unchecked) from $_POST.
2 - a link on the page that passes values in the URL. You would have to
compose the value at the time of click. php gets it via $_GET.
3 - an AJAX call from javascript. It gets the values via $_GET from the
URL that the javascript sends.

In all cases php has NO connection to the user's PC because it ALL
happens on the server.

Why would you want to set anything (other than cookie) on the user's PC?
If someone else comes along is that person going to be using the same
PC? Normally you set things on the server in either a file or a
database table.

>
>
> thanks


--
Shelly
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: 25 Essentials for Exceptional Email Campaigns
Next Topic: Return False on download
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 09:14:00 GMT 2024

Total time taken to generate the page: 0.02204 seconds