Set textbox or dropdownlist to a value when form is "new" from SP Library - InfoPath Dev
in

InfoPath Dev

Set textbox or dropdownlist to a value when form is "new" from SP Library

Last post 06-03-2009 12:53 PM by cmccollum5. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 05-27-2009 10:09 AM

    Set textbox or dropdownlist to a value when form is "new" from SP Library

    I would like to set a Status field that I have in a dropdownlist to a certain value as well as have it Read-Only when the New Form is clicked in the form library in SP.  When editing the form, I want the users to be able to change that status field and have that ddl enabled.

    I have a form that I created using VB.NET to connect to a webservice and save the contents to a sql server db and all of that works perfectly, but now I am trying to limit what users see when the form new, or editable. 

    Example: Click New Form in SP Form Library.  Form opens and if it is "new" status I want to set the Status DDL to "New" and have it read-only so the user cannot change the status.  When it is submitted and is re-opened from the list, I want the Status DDL to be editable so the users can change the status. 

    Any ideas?  I am new to InfoPath development so I am a little confused how to accomplish this. I know that in asp.net you set the ddl to a value upon load and it all works but having a hard time figuring it out in InfoPath and SharePoint.

  • 05-27-2009 10:22 PM In reply to

    Re: Set textbox or dropdownlist to a value when form is "new" from SP Library

    Hello and welcome to Forums,

    Add a Boolean field with default value as false to the data source. Set this field to true when the DDL is not blank in open rules. So for the submitted form it is true. Now add the condition to the drop down list as if the Boolean field is false then make the DDL read only and set the value to New.

    Swathip
    www.ggktech.com
  • 05-28-2009 11:15 AM In reply to

    Re: Set textbox or dropdownlist to a value when form is "new" from SP Library

    Thanks a lot for the reply!  It seems like it is going to work, but I am a couple steps away...this is what I cannot figure out:   What I did was set a rule on the Submit Button Options.  I set a condition on that rule that if the Status is not blank then in the rule I set the Boolean = TRUE.   It still opens up disabled from the SharePoint list.   BUT, I do see the dropdownlist enable after clicking Submit, but I have it set up to close after submit.  So briefly it looks like it's going to work, but after closing it's like it sets the boolean back to false.   Please let me know if I did this in the right place as I think this is why it isn't working.

    The other condition I set was on the DDL, I set the condition if Boolean = False then disable the ddl (and set the value to New).  That condition seems to be working, it is disabled when first opening and the value is New. 

  • 05-29-2009 03:26 AM In reply to

    Re: Set textbox or dropdownlist to a value when form is "new" from SP Library

    Hi,

    I think you are setting that Boolean value after submitting the form. Set this value on submit button before submitting the form. The rule which is setting the value should be before the rule which is used to submit the form.

     

    Swathip
    www.ggktech.com
  • 05-29-2009 10:53 AM In reply to

    Re: Set textbox or dropdownlist to a value when form is "new" from SP Library

    Thanks again! How do you set this value prior to submit? I guess I mean where do I set that rule? In the Submit Options?  Sorry, just too new at InfoPath!

     Thanks,
    Chris

  • 05-29-2009 09:50 PM In reply to

    Re: Set textbox or dropdownlist to a value when form is "new" from SP Library

    Hi,

    It's better to add the rule in the open rules rather than submission. Follow the below steps.

    1. Open the form in design mode.

    2. Go to Tools -> Form options -> rules.

    3. Click Add button.

    4. Click set condition.

    5. Select the drop down field in the first drop down, is not blank in the second drop down.

    6. Click ok.

    7. Click Add action.

    8. Select set a field's value in the action drop down.

    9. Select the Boolean field in the firld.

    10. Enter true() in the value.

    Swathip
    www.ggktech.com
  • 06-03-2009 12:53 PM In reply to

    Re: Set textbox or dropdownlist to a value when form is "new" from SP Library

    Thanks again, I have this part set up like you said. Then I added the condition to the dropdownlist to disable it when the Boolean field is set to false. When I submit the new form to SP, and re-open it from the list this ddl is still disabled and still blank, so it's like the Boolean field never gets set to TRUE. I want it to where I submit the new form to SharePoint, then when I re-open it, the Status field has a "New" status and is enabled. Am I still missing something?

    I'm sure it's something ridiculous that I'm not seeing but I'm so new to InfoPath that I'd rather code this in an aspx page but the client wants InfoPath  :) 

    Thanks, Chris

Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.