Prompt user to print page

Discussion in 'ASP .Net' started by Brent Burkart, Apr 26, 2005.

  1. I have a web application which consist of a huge form with many
    requiredfieldvalidators. Before the user submits, I want to prompt the
    user to print.

    I have tried to do this with the help of a CustomValidator and
    javascript, but I can't get the CustomValidator to fire.

    Does anyone have a better to approach this or maybe you can point me in
    the right direction as to why my CustomValidator is not working? Here
    is the code.


    <asp:customvalidator id="PrintValidator" runat="server"
    ControlToValidate="PrintResult" ErrorMessage="PrintValidator2"
    Display="Dynamic"
    ClientValidationFunction="validatePrint2"></asp:customvalidator>

    function validatePrint(oSrc,args)
    {
    if (args.value=="True")
    {
    args.isvalid;
    }
    else
    {
    var agree=confirm("If you have not already printed this application,
    please click 'Cancel' and do so. If you already have printed, please
    click 'OK' to submit");
    if (agree)
    return true;
    else
    return false;
    args.isvalid == false;
    }
    }


    *** Sent via Developersdex http://www.developersdex.com ***
     
    Brent Burkart, Apr 26, 2005
    #1
    1. Advertising

  2. Brent Burkart

    TDAVISJR Guest

    Well you are not adding any client event handlers to the button like so:

    MyButton.Attributes.Add["onclick", " return validatePrint(oSrc, args);"];

    http://www.builderau.com.au/program/0,39024614,39130406,00.htm


    --
    TDAVISJR
    aka - Tampa.NET Koder


    "Brent Burkart" <> wrote in message
    news:...
    >I have a web application which consist of a huge form with many
    > requiredfieldvalidators. Before the user submits, I want to prompt the
    > user to print.
    >
    > I have tried to do this with the help of a CustomValidator and
    > javascript, but I can't get the CustomValidator to fire.
    >
    > Does anyone have a better to approach this or maybe you can point me in
    > the right direction as to why my CustomValidator is not working? Here
    > is the code.
    >
    >
    > <asp:customvalidator id="PrintValidator" runat="server"
    > ControlToValidate="PrintResult" ErrorMessage="PrintValidator2"
    > Display="Dynamic"
    > ClientValidationFunction="validatePrint2"></asp:customvalidator>
    >
    > function validatePrint(oSrc,args)
    > {
    > if (args.value=="True")
    > {
    > args.isvalid;
    > }
    > else
    > {
    > var agree=confirm("If you have not already printed this application,
    > please click 'Cancel' and do so. If you already have printed, please
    > click 'OK' to submit");
    > if (agree)
    > return true;
    > else
    > return false;
    > args.isvalid == false;
    > }
    > }
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
     
    TDAVISJR, Apr 26, 2005
    #2
    1. Advertising

  3. Isn't that handled in the CustomValidator? I have a hidden text box
    that gets populated when the "Print" button is clicked. That text box
    is the control being validated.



    *** Sent via Developersdex http://www.developersdex.com ***
     
    Brent Burkart, Apr 26, 2005
    #3
  4. Isn't that handled in the CustomValidator? I have a hidden text box
    that gets populated when the "Print" button is clicked. That text box
    is the control being validated.



    *** Sent via Developersdex http://www.developersdex.com ***
     
    Brent Burkart, Apr 26, 2005
    #4
    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. gaurav kashyap
    Replies:
    2
    Views:
    656
    gaurav kashyap
    Oct 30, 2008
  2. gaurav kashyap
    Replies:
    3
    Views:
    727
    gaurav kashyap
    Oct 31, 2008
  3. Mel
    Replies:
    10
    Views:
    3,218
    Sailaja Appi
    Feb 13, 2009
  4. Trevor Tucker

    Prompt to Print Page

    Trevor Tucker, Feb 13, 2007, in forum: ASP General
    Replies:
    0
    Views:
    110
    Trevor Tucker
    Feb 13, 2007
  5. Steven
    Replies:
    3
    Views:
    259
    Dr John Stockton
    Sep 22, 2003
Loading...

Share This Page