problem with method reset()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • artev

    problem with method reset()

    if in a page I have a search form and I want use the method reset()
    for reinsert the default values, I notice that after a research, for
    the method reset(), the default values aren't more that first time loaded
    in the form but that of the form set for the search (I think so);


    see that the form is inner the same result's page, pheraphs
    the reset() 'see' how default values only the last form and not those
    that is loaded initially;

    is there some tip?
  • GArlington

    #2
    Re: problem with method reset()

    On Apr 28, 12:48 am, artev <mailnotspa...@ notspamm.nnwrot e:
    if in a page I have a search form and I want use the method reset()
    for reinsert the default values, I notice that after a research, for
    the method reset(), the default values aren't more that first time loaded
    in the form but that of the form set for the search (I think so);
    >
    see that the form is inner the same result's page, pheraphs
    the reset() 'see' how default values only the last form and not those
    that is loaded initially;
    >
    is there some tip?
    Method reset() will set all values back to what it was ON page LOAD,
    so if you want it to behave the way you describe (if I understand it
    correctly) you can:
    1) provide your own reset() function
    example code
    <input type="..." defaultValue=". .." value="..." />
    ....
    <input type="reset" onclick="myRese t()" ... />
    in you function take values from defaultValue attribute and assign it
    to value attribute...
    2) if you DO NOT want to override the reset() function you can load
    the page with default values and set current (search specific) values
    in onLoad script, then std reset() will work the way you want...

    Comment

    • VK

      #3
      Re: problem with method reset()

      On Apr 28, 3:48 am, artev <mailnotspa...@ notspamm.nnwrot e:
      if in a page I have a search form and I want use the method reset()
      for reinsert the default values, I notice that after a research, for
      the method reset(), the default values aren't more that first time loaded
      in the form but that of the form set for the search (I think so);
      >
      see that the form is inner the same result's page, pheraphs
      the reset() 'see' how default values only the last form and not those
      that is loaded initially;
      >
      is there some tip?
      Please stop posting identical queries. In the run of a couple of days
      you have posted four nearly identical queries:

      memorize form settings


      memorize all form's setting


      regards method reset()


      problem with method reset()



      That creates broken threads all around: please choose one - possibly
      this one - where you will be collecting answers and providing extra
      info if asked.

      For the question itself it was clearly answered in the very first
      thread: use reset().
      If reset doesn't work for you than you don't want to restore form's
      default values but you are willing to do something else what you
      failed to express so far.

      Comment

      • artev

        #4
        Re: problem with method reset()

        Method reset() will set all values back to what it was ON page LOAD,
        so if you want it to behave the way you describe (if I understand it
        correctly) you can:
        1) provide your own reset() function
        example code
        <input type="..." defaultValue=". .." value="..." />
        ...
        <input type="reset" onclick="myRese t()" ... />
        in you function take values from defaultValue attribute and assign it
        to value attribute..
        problem is that first time I load page I achieve default value with
        javascript;
        but when I click submit for make search, also the file
        javascript is reload so I haven't more my defalut value;
        is possible to have static variable in javascript?

        2) if you DO NOT want to override the reset() function you can load
        the page with default values and set current (search specific) values
        in onLoad script, then std reset() will work the way you want...
        can explain better?
        thanks

        Comment

        Working...