Restricting movement - InfoPath Dev
in

InfoPath Dev

Restricting movement

Last post 07-23-2010 07:57 AM by Pcheru. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 07-21-2010 01:32 PM

    Restricting movement

    Hi...Can somebody please tell me a way as to how I can restrict the cursor movement i.e., I cannot leave the block without entering a valid value.......eg: I entered a value "Z" into Quantity which is a numeric field. I should not be allowed to move to the next or any other field unless I change it to a numeric field like "8"

    Thanks in advance!!!!!!!

  • 07-21-2010 04:59 PM In reply to

    Hi Pcheru,

    This isn't a feature that InfoPath supports out-of-the-box. InfoPath can be used to add validation and to show a popup for example if the value isn't correct. That's easy to do.

    Two other methods that you could do to get what you want:

    1. Add an OnAfterChange event handler (code) to your form that checks the value and sets text selection (cursor position) to a your text field. I believe the object model method is SetTextSelection, but I may be forgetting the exact name. This can be done, but requires code.
    2. Make all of the other fields in your form read-only if the value for Quantity isn't numeric between 1 and 1,000,000. This can be done without code, but it does require setting conditional formatting on all other fields in your form. Not too hard though if you only have 10-20 fields. If you have 100, I suggest using InfoPath 2010 which allows for copying conditional format rules and will make it faster.

    Happy trails!

    Patrick Halstead
    Project Manager at Qdabra
  • 07-22-2010 06:04 AM In reply to

    Hi Patrick,

    Thanx for those ideas.....but the real scenario I am dealing with is something different. I want the field "quantity" to be filled before I can really submit the form.....may be I need to create few rules for this....I know we have a feature in Oracle forms which restricts the cursor movement thus, want to know if there is something similar here.

    Also, I tried to change a Submit event into Clickedbutton event.....do you think I have a way of dealing with the CancelableArgs used in Submit event other than getting rid of them..... 

  • 07-22-2010 07:39 AM In reply to

    You seem to be describing two entirely different things: one is manipulating the user's mouse/keyboard cursor, and the other is preventing submit under certain conditions.   The latter is a much more reasonable objective.

     Have you tried just adding validation to the field in question?  Or if you're having users submit using a button in the form, you can just disable the button (with conditional formatting) when the criteria aren't met.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-23-2010 07:57 AM In reply to

    Yes Jimmy I tried disabling the button till the value is entered but I failed to create a rule which pops up a message saying  "Please enter Quantity"......not sure how that can be done.....for now I am considering that to be fine as I am dealing with a major issue of closing the form after submitting on just one click of a button........I have the code written for submitting the form with which I am successful......also created a rule to "Close the form" but,I want both of them to happen in just one click of the "OK" button.Currently 2 steps are needed....Can u help me with this!!!!!!!!Please.......

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