JQuery Custom Save Button - Save, Validation, and Redirection Issues

We have a custom list form that we are trying to save, validate, and redirect. We can get the button to save and validate, but not redirect. And vice versa. We have tried several variations on the lines in red, all with either
no save or no redirect. We are also using this custom list form on a custom master page.
Is there something that we are doing wrong?
<script>
$(document).ready(function() {
    var button = $("input[id$=SaveItem]");
    // change redirection behavior
        button.removeAttr("onclick");
        button.click(function() {
            var elementName = $(this).attr("name");
            var aspForm = $("form[name=aspnetForm]");
            var oldPostbackUrl = aspForm.get(0).action;
            var currentSourceValue = GetUrlKeyValue("Source", true, oldPostbackUrl);
            var newPostbackUrl = oldPostbackUrl.replace(currentSourceValue, "custompageurl.aspx")
            if (!PreSaveItem()) return false;
                                                if (SPClientForms.ClientFormManager.SubmitClientForm('WPQ1')) return false;
                                                if (!Page_ClientValidate()) return false;
                                                WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(elementName, "", true,
"", newPostbackUrl, false, true));
</script>

Hi,
From your description ,my understanding is that you want to redirect to your custom page after you create a new item.
You could accomplish you requirement via sessionvars.js file, please refer to this article:
http://spjsblog.com/2009/09/04/redirect-from-newform-to-editform-or-custom-page/
Here is a similar case for reference:
https://social.technet.microsoft.com/Forums/office/en-US/b2b70571-d8bf-4633-9ed4-99f4ee40fdc3/redirect-to-a-home-page-when-on-click-of-save-button-in-a-discussion-forum-thread?forum=sharepointdevelopmentprevious
Best Regards,
Vincent Han
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected]

Similar Messages

  • How to disable SAVE button(in menu and tool bar)

    Hi all
    i have to disable the save button in menu and tool bar...
    Thanks
    raj

    Hi,
    I have an issue to disable special menu in the menu list for production supervisor responsiblity.
    I am using release 12 application. I want to achieve this using custom.pll
    I have used the following code in the custom.pll
         if (event_name='WHEN-NEW-BLOCK-INSTANCE') THEN
              if (form_name='GMEBDTED') then
              app_menu2.set_prop('Transact Material',ENABLED,PROPERTY_OFF);
         end if;
         end if;
    But when i complied this code and reopen the form still the Transact Material in the menu list enabled.
    please give ur advice
    Regards
    Prabu

  • MS CRM 2015 Adding Custom RIbbon button in dashboard and Changing Colors

    Hi,
    I am Looking for customization in MS Dynamics CRM 2015 and want to Add Custom Ribbon button in dashboard and Changing Colors of that ribbon using customization.xml i am new to crm 2015 and only know how to import export solutions.
    Regards
    Irfan

    Hello Irfan,
    For adding a custom button please refer this blog
    https://community.dynamics.com/crm/b/aeonnexuscrm/archive/2014/10/21/ms-crm-2013-adding-custom-ribbon-button-in-dashboard.aspx
    And for changing colors in Chart
    https://crmchartguy.wordpress.com/2012/08/23/palette-custom-colors-in-charts/
    Hope this helps!
    Regards, Abhishek Bakshi If you find this post helpful then please Vote as Helpful and Mark As Answer. Check my blog on https://mydynamicscrmblog.wordpress.com/

  • "Send and Save" button in trips and travel expenses

    hello guru's.
    i have a problem
    i implemented in my SAP portal the Travel Management package.
    I have a problem
    in travel expenses iview, you arrive in last step you can Save and Send the data.
    But the user can push this button more time!!! so manager can receive many time this data and this is not correct!!
    there are a way for fix this problem??
    thanks
    Alex

    I am having a problem with the buttons "Save"and "Save and Send to Approval".
    The users are choosing "Save" instead of "Save and Send to Approval" and then the trip does not go to the approval step.
    It is creating many problems and we need to hide this option "Send", just displaying to user the option "Save and Send to Approval".
    Anyone knows if have a standard solution for this case?
    Thanks,
    Thiago

  • XML Forms - Save Button  in ListEdit and Counter in RenderListItem

    How can I put a save button in ListEdit to save changes that i made in fields without entering in edit mode.
    I'm trying to put a counter in a renderlistitem form but the counter don't increment. It stays always in number one. What am i doing wrong?

    No, the idea about this counter is for example i have a list of FAQ's:
    1. First Faq
    2. Second Faq
    3. Third Faq
    I want to put automatically the number of the FAQ before the question.
    For example if i remove "Second Faq" the list should be like this:
    1. First Faq
    2. Third Faq.
    Now i'm using javascript to do it.

  • Button to Submit and redirect

    I'm trying to put a button on a page that will submit the current page and redirect to another. I've tried creating buttons but I'm not able to accomplish both Submit and redirect. So I have created an HTML region and am trying to build the HTML myself. This code is submitting the current page (19) but isn't redirecting to new page (20). Can someone please give me some advise.
    Thanks
    Mary Jo
    <table>
    <tr>
    <td colspan="1" rowspan="1" align="left">
    <img src=#WORKSPACE_IMAGES#user.gif" alt="&amp;nbsp;" border="0" ></a>
    <a href="f$p=111:20:&APP_SESSION.::NO:::YES"
    <a title="Edit" href="javascript:popupURL('f?p=111:20:&APP_SESSION.:::::');" tabindex="999"><img src="/i/e.gif" alt="Edit" class="eLink" /></a></td>
    </td>
    </tr>
    </table>

    Mary Jo,
    Branches are designed for what you're doing; they control how the user flows through the application from page to page. When you create a new button, you'll be prompted for a page to branch to. If you ended up creating a button without a branch, you can create a new branch using the following steps:
    1) run the page with the button on it
    2) In the developer toolbar at the bottom of the page, click New
    3) Choose page control
    4) Choose branch
    5) Click Next
    6) In the Page field, type the ID of the page you'd like to redirect to after the page has been submitted.
    7) Click Next
    8) Choose the button you'd like the branch to fire for
    9) Click Create Branch
    Sergio

  • How to disable 'Save' button when OAF and XML Publisher integrated...URGENT

    Hi,
    I am new to the OA Framework and XML publisher. I have been working on a requirement where I am designing a new page in Manager Self Service with few fields and a submit button. Also designed a RTF template in XML publisher to display the output in PDF format.
    When the details are entered on the page and click on 'Submit' button, the PDF will Open with the data populated. This is working perfectly... thanks to the forum.
    But my issue is: When the submit button is clicked, it displayes a dialog box with Open/Save/Cancel options and if I click the 'Open', the PDF will be opened. But my client is a retail client and they don't want store managers to save this PDF so either I have to skip this dialog box and directly open the PDF or I have to disable the 'Save' on the dialog box.
    Gurus -- Please help me how to achieve this. This is very urgent
    Below is the piece of code I am using in the controller to generate the PDF.
    TemplateHelper.processTemplate(
    ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getAppsContext(),
    APP_NAME,
    TEMPLATE_CODE,
    ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getLanguage(),
    ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getCountry(),
    inputStream,
    TemplateHelper.OUTPUT_TYPE_PDF,
    null,
    pdfFile);
    Thanks in Advance,
    Naren

    Frank, thanks for the update.
    But do you want me to try ControllerContext.getInstance().getCurrentViewPort().isDataDirty(); in button disable property?
    I have written one method in my am like
    public boolean isTransactionDirty(){
    return getDBTransaction.isDity();
    and exposed that method to client side and i try to use this method in my button disable property as
    disable#{bindings.isTransactionDirty.execute} but this is not working.
    Thanks

  • Jquery customizing dialogue box for validations messages,

    Hi everyone,
    I create a new template label with this script:
    <script type="text/javascript">
    $('#errdialog').find('ul').append($('<li/>',{text:'#ERROR_MESSAGE#'}));
    </script>
    I'm using this function to create a
    dialogue box on my apex application:
    Page HTML header
    <script type="text/javascript">
    $(function(){
    if($('#errdialog').find('li').length>0){
    $('#errdialog').dialog({
    modal:true,resizable:false,
    buttons:{"Ok":function(){$(this).dialog("close")}}
    </script>
    And this html code in Page Header Text:
    <div id="errdialog" title="Validation Error !" style="display:none"><ul/></div>
    What I would like to do is to customize this dialogue box.
    For instance in my app the box background it's gray, it's text are black,
    and the upper banner it's a darker gray. I would like to be able to change
    it all and put a html button as an ok to close the box.
    Edited by: 907910 on 29/02/2012 15:10

    Thanks, Scott for the material, the problem is
    that I know very little about html css and jquery,
    and I have to end my apex application by monday.
    I've already look into the documentation, but I can't
    modify my dialog box.
    Can you give me a example how to customize the dialog box?

  • Save Button saves in data base not adding on form.In Detail form of M/D For

    Hello Everyone,
    Please help me on following.
    I ahve mater detail form and in detail form i have only one field displaying and if i add new row it adds and if i put new data in subject name and save it .It saves in database but doesn't display in form.
    I have
    Table A with
    CaseId PK (Master Table)
    Table B
    CaseID-FK &
    Subject Id PK(Detail Table)
    Edited by: user639035 on Mar 17, 2010 8:44 AM

    REPORT  YH648_1111111.
    TABLES SSCRFIELDS.
    parameter : c  AS CHECKBOX USER-COMMAND SUNIL
    AT SELECTION-SCREEN .
    SY-UCOMM = SSCRFIELDS-UCOMM.
    START-OF-SELECTION.
      CASE SY-UCOMM.
        WHEN 'SUNIL'.
          WRITE 'SUNIL KUMAR .BETHINEDI'.
        WHEN ' '.
          WRITE 'BLA BLA BLA '.
    ENDCASE.
    THIS IS THE WAY U CAN USE THE CHECK BOX.
    INSTED OF THIS  WRITE 'SUNIL KUMAR .BETHINEDI'.
    U USE THE INSERT STATEMENT.

  • Issue with custom toolbar button in alv and leave screen

    Hi,
    in one subscreen (say screen 100)i have an alv with custom ADD  toolbar button..so in the user_command event handler ,i call a antoher screen(dialogue)..like if i click on ADD button ,it should display dialogue screen(say 200) and after entering input in dialogue screen i click on CONINUE to retrun to screen 100..problem is for the first time i click on ADD button its working fine ,succesffyuly returned to screen 100...but for the second time i click on add button , i have to click on twice the CONTINUE button to retrun to screen 100..when debuggin i found the user_command event routin is executin twice ..any solution..
    Thanks,
    srini

    Apparently handler is set for every new ALV instance. This you get by executing CREATE OBJECT alv... every time PBO is raised. Ensure you are executing this statement only once duirng program lifetime. Then the system will match event handler only with one ALV instance (executing it once).
    if r_alv is not bound.
       CREATE OBJECT r_alv ...
       SET HANDLER ...
    endif.
    Regards
    Marcin

  • InfoPath 2010 and REST web services, custom code button firing twice and second click fires error

    Hi,
    I have two supposing simple issues which I'm having problems correcting.
    If a add a button to the form and write some custom code (See below) to submit some data via a REST Web Service data connection. The code runs but somehow fires the URL twice to the web service.
    I've also recreated similar functionality using Rules on a button and some concat formulas and exactly the same thing happens when I the run the data using the Query Data Action, it fires the URL twice at the web service.
    How can I stop this.
    Secondly, if I use the custom code route, it work correctly the first time it pressed except for the double fire issue, but the second time I click the button the InfoPath internal system throws up an issue. See screen shot below.
    Any help would be appreciated.
    Rob
    namespace SubmitTest
    public partial class FormCode
    // Member variables are not supported in browser-enabled forms.
    // Instead, write and read these values from the FormState
    // dictionary using code such as the following:
    // private object _memberVariable
    // get
    // return FormState["_memberVariable"];
    // set
    // FormState["_memberVariable"] = value;
    // NOTE: The following procedure is required by Microsoft InfoPath.
    // It can be modified using Microsoft InfoPath.
    public void InternalStartup()
    //EventManager.FormEvents.Submit += new SubmitEventHandler(FormEvents_Submit);
    ((ButtonEvent)EventManager.ControlEvents["SaveDataPoint"]).Clicked += new ClickedEventHandler(SaveDataPoint_Clicked);
    /*public void FormEvents_Submit(object sender, SubmitEventArgs e)
    // If the submit operation is successful, set
    // e.CancelableArgs.Cancel = false;
    // Write your code here.
    MessageBox.Show("Submit Function Start");
    //SaveDataPoint_Clicked(sender);
    MessageBox.Show("Submit Function End");
    public void SaveDataPoint_Clicked(object sender, ClickedEventArgs e)
    try
    FileQueryConnection fqcConnection = (FileQueryConnection)this.DataConnections["TestREST"];
    string fqcFileLocation = fqcConnection.FileLocation;
    MessageBox.Show("fqcFileLocation " + fqcFileLocation);
    fqcFileLocation = fqcFileLocation + "?TestName='HugeArse'";
    fqcConnection.FileLocation = fqcFileLocation;
    fqcConnection.Execute();
    catch (Exception ex)
    MessageBox.Show("NewDataPoint_Clicked: Error " + ex);

    Hi Phillip6653,
    Did you check the similar
    thread to uninstall the windows update KB2756920 which was published on day 1/10? After auto install the update, on day 1/11, the same error occur when I open site using designer, after I uninstall it, it works for me, please have a check.
    For more information, see
    http://consultingblogs.emc.com/shailensukul/archive/2010/09/17/sharepoint-designer-error.aspx
    http://daniyar-tech.blogspot.com/2012/01/sharepoint-designer-2010-error.html
    Best Regards.
    Kelly Chen
    TechNet Community Support

  • Subtitle buttons - fast-forward and rewinding issue

    I am new to DVD Studio Pro 4 and I have project that uses a subtitle button over a video track to provide users with the ability to go "back" to the previous menu - the menu in which they selected the track.
    There is a problem using this method however, when fast-forward or rewind is pressed, then the track starts to play again, the back button is now hosed. My thought is that this is because of the chapter markers not being refreshed in the middle of a subtitle, only at the begining and end like bookends.
    Is there a way around this? If not, are there any buggy issues with locking down the user controls for fast-forward and rewind? Any help would be much appreciated...
    -charlie

    You can lock out the User Ops for Fast Forward Rewind or whatever you want. Probably a good idea if you are using the track as a menu effectively.
    If however the track is amovie and you want them to go back to the menu where they selected it you can target the menu for any track to go back to a specific menu. Click on the track and check out the Inspector near the bottom where it syas Remote Control. Target the menu you want people to go to back to when they press Menu on their Remote
    Steve Kirkham

  • How to 'Save' button in alv

    The data is displayed in alv grid. and pf-statuses are also set. But the save button is disabled. and in Pf-status sub_routine of ALV , set PF-status excluding t_t*** (dont remember exact name) was used.
    Could any one tell me how to make it so that the save button is enabled.
    thanks n regards

    Triven,
    The SAVE Function Code in the ALV GUI Status is by default not assigned.  What you'll need to do is copy the GUI Status STANDARD from the Function Group SALV.
    Then modify it by adding an Function Code to what  you want to intercept.
    In  your program, you can then call using this PF STATUS like this
    * Call ABAP/4 List Viewer
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program       = repid
                i_callback_pf_status_set = 'STAT_0100'   "<== Custom PF Status FORM to Call
                is_layout                = gs_layout
                is_print                 = gt_print
                it_sort                  = gt_sort[]
                it_events                = gt_events[]
                it_fieldcat              = gt_fieldcat[]
                i_save                   = 'A'
           TABLES
                t_outtab                 = it_display.
    ENDFORM.                    " detail_layout_build
    *       FORM STAT_0100                                                *
    FORM stat_0100 USING gt_exclude.                   "<== Custom PF Status FORM
      SET PF-STATUS 'STAT_0100' EXCLUDING gt_exclude.  "<== you can use your existing Exclude module
    ENDFORM.                "end custom PF Status
    Edited by: Paul Chapman on Apr 25, 2008 7:26 PM

  • Enabling the save button

    I was having a problem with an unbound item where if a user entered data into it and wanted to save, the save button on the menu was disabled. To get around this problem I created a post-change trigger for the unbound item where I used the set_menu_item_property to set the save button to enabled and this worked fine. I have another unbound item below the first one and I needed to do the same thing (eg. create a post-change trigger to enable the save button) but for this unbound item it doesn't work. When I go to the next item the save button remains disabled. Can anyone tell me why it works for one and not the other?
    thanks
    Cathy

    Run the debugger and single-step through your code and see what is and is not happening.

  • Which trigger fires after pressing 'Save' button on toolbar.

    hi,
    I wanted to know which triggers get fired after pressing 'save' button on toolbar, and in which sequence it get's fired.

    When you press 'save' it tries to do a commit_form.
    Before commiting the form, it checks for any errors which might occur at form level, block level or item level and does the commit only when it doesn't find one.

Maybe you are looking for

  • HP OFFICEJET 6500 709A WILL NOT SCAN FROM FRONT PANEL ON MACHINE os windows 7 what must be done?

    I have an oj 6500 709a all in one that will not scan when I press the scan button on machine.I have doown loaded all the updates and drivers.what must be done ?

  • Problems with FOI layer using mod_wl in Apache

    Hello everybody, I have published my application on web. I use MapViewer 1033 on Solaris 10 and Apache 2.0.59 on Windows XP. To proxy my requests I use mod_wl module in Apache. When I try to load base map everything is ok. But when I try to load FOI

  • How to video out without closing the lid ?

    Dear all, I have a macbook from the latest generation with an external screen plugged on the DVI. If I want to use the screen as main display and not the one from my macbook, I need to close the lid of my laptop and reactivate it with my bluetooth mo

  • How to do Landscape style in PDF format.

    Hi, i encountered the problem with doing Landscape style for my report, and export the report in PDF format with Landscape, any tips? Thanks. Joe

  • AP Creditor Cleansing

    Hi All, We are about to undertake a cleansing exercise on our creditor records. An initial workshop has raised a few issues in data entry and the subsequent difficulties in reporting on vendors and transaction types. I am certain that these issues mu