I've spent the better part of three days trying to wrap my head around UpdatePanel and _DoPostBack to find a solution to my problem with my infopath browser enabled form.

I have a simple script that displays a popup on a button click which works until a postback occurs (that's what I'm assuming anyway). I have a choice control (combobox) that when populated performs a postback. After the postback occurs I lose the button functionality described above until I refresh (F5). I'm looking for a solution client side that I can implement in a js file as I use CEWP's to implement my code. I'm not against making changes to the page itself using SPDesigner and advanced editing, however, I would like to keep it in the js file as much as possible.

If I can get past this problem it will open up way more options for me as I'm currently only running scripts on pages with no postbacks until the form is saved and exited.

I've tried dissecting this tutorial, however, I'm unsure how to implement:

I've tried numerous solutions to no avail such as:
jQuery autocomplete dissapears on postback and the JQuery .Live() / .On() solution.

See my simple script below:

 <script language="javascript" type="text/javascript">
 ExecuteOrDelayUntilScriptLoaded(pageLoad, "sp.js");
   function pageLoad(sender, args)   
    // Button click - Set Due Date  
           alert("It worked...");
        }); // End Due Date
    } // End pageLoad  
  • Can you provide the script? And have you ran IE Dev tools during this process? If there's any javascript errors, it should tell you.
    – wjervis
    Jul 7, 2015 at 18:11
  • I get no errors and console shows nothing as well. It just doesn't work after I select a choice in the drop down field. I've added my script to the original post...
    – Ghoztrider
    Jul 7, 2015 at 19:36

1 Answer 1


Selecting a value in your dropdown is probably causing a postback, which can mess up your JavaScript and may mess with control IDs etc. Monitoring closely in your browser's developer tools should give a better idea of what's going on.

Unless you're doing something more complicated than your example above, I would suggest that it would be far easier to achieve what you want with InfoPath's built in functionality.

For example, rather than using JS to set the title for a control, you can add a textfield to your form, set it to be read-only and format it to have no shading and no borders. That will effectively give you a label you can place beside your control, and you can set it's text value using a rule on the drop down.

Instead of a popup alert, you can repeat the same trick as above to create an "alert label", but add an extra field to your form's datasource to say if it should be displayed or not. Then add a conditional formatting rule to your "alert" label, to hide depending on the value of that field. Or to get a bit fancier, you could add a section to your form, put the "alert label" in the section and set the conditional formatting rule on that. Then in the rules for your dropdown, set the text for the alert and set the field to say if it should be displayed or not.

It's not the prettiest solution from a programmer's perspective, but it should work very reliably in InfoPath.

  • I do agree with you on the alert portion of the script, again this is just a test sample script. I'm actually looking to grab information from another list based on the id (which I've done successfully when no postback is required). I didn't want to test this with the full script if I can't even get the alert popup to work. I will research more on postback. Thanks.
    – Ghoztrider
    Jul 8, 2015 at 12:51
  • One thing worth checking, is that with the InfoPath controls, you can control when they trigger a postback. Right click on the control in designer and go to it's properties. On the last properties tab you can set if the control should trigger a postback "Always", "Never" or "If Required" or something like that. You could try setting your control to never and see if that helps. Jul 14, 2015 at 14:40
  • Very close Steven! This gets me halfway there, I can use this trick if I'm not cascading dropdowns, however, I still need the post back on some occasions. Thanks for tip!
    – Ghoztrider
    Jul 14, 2015 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.