Call a javascript when i call an aspx page with a form html not running on server

Discussion in 'ASP .Net' started by Fabio Mastria, Jan 25, 2008.

  1. My application has to call a webpage with some hidden field, fill their
    values with some parameters and then call the submit to the form which has
    the action property set to a page of another web application.

    all of this, did via javascript.

    how can i send the data to fill the hidden fields to this web form?

    Please help me, thank you!
    Fabio
     
    Fabio Mastria, Jan 25, 2008
    #1
    1. Advertising

  2. Fabio Mastria

    Patrice Guest

    Not sure what is the particular problem. The simplest would be to create the
    page server side with those hidden fields already filled with values. If you
    have to get them from client side inputs you could use
    getElementById('MyClientSideControlID').value='MyValue' to fill the value of
    a field form. The "form.submit" method allows to programmatically submit the
    form...

    My personal preference would be likely to do that server side using
    System.Net.WebClient (it allows to send a POST query with form values to a
    particular target page and get the response).

    If you prfer doing still cleint side, you may want to be a bit more specific
    about the exact point that causes the problem (not sure if it's filling the
    hidden fields, submitting the data or whatever else...)


    --
    Patrice

    "Fabio Mastria" <> a écrit dans le message de
    news: ...
    > My application has to call a webpage with some hidden field, fill their
    > values with some parameters and then call the submit to the form which has
    > the action property set to a page of another web application.
    >
    > all of this, did via javascript.
    >
    > how can i send the data to fill the hidden fields to this web form?
    >
    > Please help me, thank you!
    > Fabio
     
    Patrice, Jan 25, 2008
    #2
    1. Advertising

  3. Fabio Mastria

    Patrice Guest

    Ah. If I finally understood the page that contains those hidden fields is
    not yours.

    Your application must submit to this page values as if they were coming from
    those hidden fields...You'll have then to send a request to this page with
    the same field names (either by "reproducting" this page client side or by
    sending a request server side by using System.Net.WebClient).

    Note though that the page that contains those hidden fields could also
    perform additional checks to see if data are coming from itself instead from
    an external source (i.e. in most cases the site owner should document how to
    do this, else it could be even not possible if the appropriate safety
    measures have been implemented to prevent this).

    --
    Patrice

    "Patrice" <http://www.chez.com/scribe/> a écrit dans le message de news:
    ...
    > Not sure what is the particular problem. The simplest would be to create
    > the page server side with those hidden fields already filled with values.
    > If you have to get them from client side inputs you could use
    > getElementById('MyClientSideControlID').value='MyValue' to fill the value
    > of a field form. The "form.submit" method allows to programmatically
    > submit the form...
    >
    > My personal preference would be likely to do that server side using
    > System.Net.WebClient (it allows to send a POST query with form values to a
    > particular target page and get the response).
    >
    > If you prfer doing still cleint side, you may want to be a bit more
    > specific about the exact point that causes the problem (not sure if it's
    > filling the hidden fields, submitting the data or whatever else...)
    >
    >
    > --
    > Patrice
    >
    > "Fabio Mastria" <> a écrit dans le message
    > de news: ...
    >> My application has to call a webpage with some hidden field, fill their
    >> values with some parameters and then call the submit to the form which
    >> has the action property set to a page of another web application.
    >>
    >> all of this, did via javascript.
    >>
    >> how can i send the data to fill the hidden fields to this web form?
    >>
    >> Please help me, thank you!
    >> Fabio

    >
    >
     
    Patrice, Jan 25, 2008
    #3
  4. Fabio Mastria

    adwb Guest

    RE: Call a javascript when i call an aspx page with a form html not ru

    What type of application are you writing? Is it an ASP.NET app running on
    your server that users will interact with to fill form fields and submit a
    form on a page running on another server?

    "Fabio Mastria" wrote:

    > My application has to call a webpage with some hidden field, fill their
    > values with some parameters and then call the submit to the form which has
    > the action property set to a page of another web application.
    >
    > all of this, did via javascript.
    >
    > how can i send the data to fill the hidden fields to this web form?
    >
    > Please help me, thank you!
    > Fabio
    >
    >
     
    adwb, Jan 25, 2008
    #4
  5. adwb wrote:
    > What type of application are you writing? Is it an ASP.NET app
    > running on your server that users will interact with to fill form
    > fields and submit a form on a page running on another server?
    >


    asp.net web application.

    Patrice wrote:
    > Ah. If I finally understood the page that contains those hidden
    > fields is not yours.


    The page with the hidden fields, is in my application.

    this page has to be submitted to another page which is not in my
    application.

    After some operation, i have to call my page, fill the hidden fields and
    submit via post the form to that page which is not in my application.

    My page sounds like

    <form id="form1" action=www.notmyapplication.com/notmypage.aspx
    method="post" >

    hiddenfield1

    hiddenfield2

    ....

    </form>

    the notmypage read the hiddens, and call a page in my application with some
    value to read via Request object.

    That's it.

    A question: can I use a server form with action and method using then a
    server button which submit the form? This to send post to the
    notmypage.aspx...

    In this case, I can fill via server side the hiddend fields values..



    > Your application must submit to this page values as if they were
    > coming from those hidden fields...You'll have then to send a request
    > to this page with the same field names (either by "reproducting" this
    > page client side or by sending a request server side by using
    > System.Net.WebClient).



    sorry I don't know how to use the webclient class, have you some example?
     
    Fabio Mastria, Jan 28, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mr. x
    Replies:
    1
    Views:
    1,971
    John Timney \(Microsoft MVP\)
    Nov 30, 2003
  2. John M
    Replies:
    1
    Views:
    1,174
    Kumar Reddi
    May 29, 2005
  3. Progman
    Replies:
    2
    Views:
    1,919
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Feb 13, 2006
  4. MadHatter51
    Replies:
    1
    Views:
    872
    Hakan Lambracht
    May 17, 2006
  5. Replies:
    3
    Views:
    798
    Guillermo
    Apr 26, 2007
Loading...

Share This Page