Focus on previously selected page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • question.boy@hotmail.com

    #1

    Focus on previously selected page

    Hell,

    I have a web page in which I have different tab/divs. So when the
    user selects different tabs the the url changes to





    What I am trying to do is reset the focus on the currently selected
    tab when the form is submitted. For instance, when the user make a
    selection in a form it always return the url to http://localhost/db/adminconsole.php

    How can I trap the current url and set it have running the rest of my
    code to save/delete/...?

    Thank you,

    QB
  • Rik Wasmus

    #2
    Re: Focus on previously selected page

    On Tue, 13 May 2008 13:48:36 +0200, <question.boy@h otmail.comwrote :
    Hell,
    >
    I have a web page in which I have different tab/divs. So when the
    user selects different tabs the the url changes to
    >



    >
    What I am trying to do is reset the focus on the currently selected
    tab when the form is submitted. For instance, when the user make a
    selection in a form it always return the url to

    >
    How can I trap the current url and set it have running the rest of my
    code to save/delete/...?
    By javascript, not with PHP alone (the fragment isn't even sent to the
    server AFAIK). Probably you'll have to set a cookie with javascript on
    changes & load time, and then either act accordingly with PHP's output
    (set a particular div visbile, the rest hidden/display:none), or do that
    with javascript after the pageload.
    --
    Rik Wasmus
    [SPAM] Now temporarily looking for some smaller PHP/MySQL projects/work to
    fund a self developed bigger project, mail me at rik at rwasmus.nl. [/SPAM]

    Comment

    • C. (http://symcbean.blogspot.com/)

      #3
      Re: Focus on previously selected page

      On 13 May, 12:59, "Rik Wasmus" <luiheidsgoe... @hotmail.comwro te:
      On Tue, 13 May 2008 13:48:36 +0200, <question....@h otmail.comwrote :
      Hell,
      >
      I have a web page in which I have different tab/divs. So when the
      user selects different tabs the the url changes to
      >>
      What I am trying to do is reset the focus on the currently selected
      tab when the form is submitted. For instance, when the user make a
      selection in a form it always return the url to
      http://localhost/db/adminconsole.php
      >
      How can I trap the current url and set it have running the rest of my
      code to save/delete/...?
      >
      By javascript, not with PHP alone (the fragment isn't even sent to the
      server AFAIK). Probably you'll have to set a cookie with javascript on
      changes & load time, and then either act accordingly with PHP's output
      (set a particular div visbile, the rest hidden/display:none), or do that
      with javascript after the pageload.
      As a general rule I'd avoid using cookies for transferring information
      explicitly between one page and the next - rather I only use cookies
      for session related data or user related data. My prefered solution
      would be to use a hidden form field. However the cookie approach dose
      mean that the entire behaviour can be encapsulated with javascript if
      POSTs are used.

      C.

      Comment

      • question.boy@hotmail.com

        #4
        Re: Focus on previously selected page

        On May 13, 8:07 am, "C. (http://symcbean.blogsp ot.com/)"
        <colin.mckin... @gmail.comwrote :
        On 13 May, 12:59, "Rik Wasmus" <luiheidsgoe... @hotmail.comwro te:
        >
        >
        >
        >
        >
        On Tue, 13 May 2008 13:48:36 +0200, <question....@h otmail.comwrote :
        Hell,
        >
        I have a web page in which I have different tab/divs.  So when the
        user selects different tabs the the url changes to
        >>
        What I am trying to do is reset the focus on the currently selected
        tab when the form is submitted.  For instance, when the user make a
        selection in a form it always return the url to
        >http://localhost/db/adminconsole.php
        >
        How can I trap the current url and set it have running the rest of my
        code to save/delete/...?
        >
        By javascript, not with PHP alone (the fragment isn't even sent to the
        server AFAIK). Probably you'll have to set a cookie with javascript on
        changes & load time, and then either act accordingly with PHP's output
        (set a particular div visbile, the rest hidden/display:none), or do that
        with javascript after the pageload.
        >
        As a general rule I'd avoid using cookies for transferring information
        explicitly between one page and the next - rather I only use cookies
        for session related data or user related data. My prefered solution
        would be to use a hidden form field. However the cookie approach dose
        mean that the entire behaviour can be encapsulated with javascript if
        POSTs are used.
        >
        C.- Hide quoted text -
        >
        - Show quoted text -
        I was playing around with an onclick event for the tab to populate the
        url into an input control. For some reason, all the data from my
        other control gets posted but not this one control with the url? So I
        came here to ask the question. There wouldn't happen to be an example
        somewhere I could inspire myself from?

        QB

        Comment

        • Rik Wasmus

          #5
          Re: Focus on previously selected page

          On Tue, 13 May 2008 14:17:31 +0200, <question.boy@h otmail.comwrote :
          On May 13, 8:07 am, "C. (http://symcbean.blogsp ot.com/)"
          <colin.mckin... @gmail.comwrote :
          >On 13 May, 12:59, "Rik Wasmus" <luiheidsgoe... @hotmail.comwro te:
          >>
          On Tue, 13 May 2008 13:48:36 +0200, <question....@h otmail.comwrote :
          Hell,
          >>
          I have a web page in which I have different tab/divs.  So when the
          user selects different tabs the the url changes to
          >>>>
          What I am trying to do is reset the focus on the currently selected
          tab when the form is submitted.  For instance, when the user make a
          selection in a form it always return the url to
          >http://localhost/db/adminconsole.php
          >>
          How can I trap the current url and set it have running the rest of
          >my
          code to save/delete/...?
          >>
          By javascript, not with PHP alone (the fragment isn't even sent to the
          server AFAIK). Probably you'll have to set a cookie with javascript on
          changes & load time, and then either act accordingly with PHP's output
          (set a particular div visbile, the rest hidden/display:none), or do
          >that
          with javascript after the pageload.
          >>
          >As a general rule I'd avoid using cookies for transferring information
          >explicitly between one page and the next - rather I only use cookies
          >for session related data or user related data. My prefered solution
          >would be to use a hidden form field. However the cookie approach dose
          >mean that the entire behaviour can be encapsulated with javascript if
          >POSTs are used.
          And a GET still works with cookies.
          I was playing around with an onclick event for the tab to populate the
          url into an input control. For some reason, all the data from my
          other control gets posted but not this one control with the url? So I
          came here to ask the question. There wouldn't happen to be an example
          somewhere I could inspire myself from?
          If you populate a form field with a value, and you submit that form, it
          should be there. If that doesn't work, checking what actually happens with
          a combination of FireBug (for the DOM changes) and LiveHTTPHeaders (for
          the actual POSTs/returns), which are a quick way to find the problem.
          However, if the url is in a field and doesn't make it to the server, the
          problem is 99% sure with the javascript involved, and definitely not PHP.
          --
          Rik Wasmus
          [SPAM] Now temporarily looking for some smaller PHP/MySQL projects/work to
          fund a self developed bigger project, mail me at rik at rwasmus.nl. [/SPAM]

          Comment

          Working...