Submit button doesn't work when data is retrieved from database - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Submit button doesn't work when data is retrieved from database

Last post 05-11-2007 02:44 AM by ahardin. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 05-02-2007 08:13 AM

    Submit button doesn't work when data is retrieved from database

    Condition: if Case Date > today(), then disable submit button.
    It works fine. However, when I call the data back from the database, the submit button is disabled.

    If I pick the date again, it will become enabled. The disabled situation only occurs when Case date = today

    I have no idea why this is happening. Also, anything compares to today(), and the date is today's date.

    Everything will become disabled. I don't know why it is working when entering data, but not working when call the data back form the database if the date is today's date.

    Is the a issue of Infopath, or I missed something when setting the conditions.

    Thanks.

  • 05-02-2007 08:17 AM In reply to

    Re: Submit button doesn't work when data is retrieved from database

    Hi troy0118,

    I think the problem here is that when the date comes back from the database, it is not in the right format.  Try looking at the date returned from the DB in a straight textbox without formatting to look at how the database is returning it.  You might have to write some code that alters the date formatting whenever you pull stuff down from the database.  The reason it works when you re-select the date is because InfoPath formats the date that you select correctly.

    Hope this helps!

    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 05-02-2007 10:16 AM In reply to

    Re: Submit button doesn't work when data is retrieved from database

    Thanks, Matt.

    I got the data from a expression box, and it shows "2007-05-02T00:00:00"
    The way it will work out is to wirte code to get the date like "2007-05-02"  Is this what you recommend?
    The data set is from DB. How I can format it before it shows on the screen? Could you give me some references?

    Thanks.

  • 05-05-2007 08:16 PM In reply to

    Re: Submit button doesn't work when data is retrieved from database

    Hi troy0118,

    Weird, I would have thought that that style of the date would work. However, creating a rule to change the format should be easy.

    1. Double-click the field in the Data Source Task Pane
    2. Go to the rules tab and add a new rule. Set the condition to be IF fieldValue CONTAINS 'T', then SET FIELD VALUE to 'substring-before( fieldValue, 'T' )

    Hopefully that will do the trick! If not, let us know.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 05-09-2007 07:44 AM In reply to

    Re: Submit button doesn't work when data is retrieved from database

    Hi Matt,

    Thanks, it works. However, it doesn't solve my problem.

    I set the rule under a dorp down. First it shows "2007-05-02T00:00:00" And after I click on the value, the value changes to "2007-05-02"
    By definition, "Use rules to apply actions when users change the value in this control."
    Indeed, there are two values in the drop down after the action is taken: "2007-05-02T00:00:00" and "2007-05-02"
    I suppose that it doesn't really change the value, instead adding one into the drop down.
    This is OK if I can't get it.

    My real concern is the date picker. There is a condition to disable the submit button based on the comparison of two dates.
    Since one date will come back from the DB, the format will become "2007-05-02T00:00:00" which is not comparable.
    If I click on the date which come from DB again, then the conditon will apply because the format becomes "2007-05-02"
    This is similar to the method you advised, which requires a click action.

    Do you have other recommendations?

  • 05-10-2007 12:40 AM In reply to

    • ahardin
    • Top 200 Contributor
    • Joined on 02-13-2006
    • United Kingdom
    • Posts 55

    Re: Submit button doesn't work when data is retrieved from database

    Hi

    I think this is relatively simply solved as i have made this mistake myself.

    Your problem is only when you pull the record back from the database, immediately the form sets the Case Date = Today() so the button is disabled.  When you reset the date it works fine, no surprise!

    To sort, you need to untick the "Update this value when the result of the formula is recalculated", this will then set the value once, but will not re-set it when recalling it from the database, if that does not work then instead of using the "Default Value" use a rule firing from another field or on form opening to set the @Case_Date value ONLY where @Case_Date is currently blank, that would definitely work.

    I hope this helps

    Adam

    I'm from WALES
    adamrharding@hotmail.com
  • 05-10-2007 07:07 AM In reply to

    Re: Submit button doesn't work when data is retrieved from database

    Thanks, Adam.

    I do not check off the checkbox "Update this value when the result of the formula is recalculated." It will cause me a lot of problems.
    The issue is when the data come back from the DB, the format becomes "2007-05-02T00:00:00," which doesn't allow me to do any comparison.

    I tried to format the date in DB before, but it didn't work out. I just cannot get rid of the time from DB.

  • 05-10-2007 08:23 AM In reply to

    Re: Submit button doesn't work when data is retrieved from database

    Hey troy,

    You should be able to add code or rules on a button that will remove the T00:00:00.  You will use the substring-before() function.  If all else fails, you could try creating a view in the database that has a column that gets the correct substring that you are trying to pull down.

    Good luck!

    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 05-10-2007 10:22 AM In reply to

    Re: Submit button doesn't work when data is retrieved from database

    Thanks, Matt.

    I solved this issue on the date picker by using substring-before() function, but not the dorp-down. No matter what I did, the drop-down always has the "T" stuff.

    Sicne the dorp-down carries a secondary data source, if I want to get rid of the "T00:00:00," I have to write code??

  • 05-11-2007 02:44 AM In reply to

    • ahardin
    • Top 200 Contributor
    • Joined on 02-13-2006
    • United Kingdom
    • Posts 55

    Re: Submit button doesn't work when data is retrieved from database

    Troy

    Sorry my misunderstanding.  Create a new field on the form and set that to equal the data from the database.  Then set your drop-down's default value to equal the substring of the new field.

     

    That should work fine.

    Adam

    I'm from WALES
    adamrharding@hotmail.com
Page 1 of 1 (10 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.