In a dynamic form with custom validation I need to have two different submit buttons. One to submit form data as is and and other to validate the data first then submit.
How can I create a submit button that skips validation?
Thx
Solved! Go to Solution.
Views
Replies
Total Likes
The allChileElements will give you everything under that node (fields, subforms, draws, etc....) Some of those objects do not have a validate property. Thats why there is a further qualification where we are grabbing objects with a specific className of subform or field. If it is a subform then we need to dig deeper into that structure, if it is a field then we can set the validation.
Make sense?
paul
Views
Replies
Total Likes
You can''t force the skipping of the validations. You woudl have to create a different means of performing validations by not using the validate event but by calling your validations from your own program when you hit th enon validate submit button.
Make sense?
Paul
Views
Replies
Total Likes
Thx for the reply Paul. I am not calling any validate event of any field. They are being called automatically when the submit button is clicked.
Some of my fields have some function calls under their validate event. I need to find a way to either not call does funtions when button A is pressed or may be set a global variable to true as soon as the button is pressed? then check for that at validate event of my fields to see if validation needs to be performed.
What do you think of that?
Where is the best place to make declare this global variable and at which event of Button A should I set it to true?
Views
Replies
Total Likes
That woudl work fine .....you can use a hidden field to hold your status variable and I woudl use the click event of the button to execute your code. If you have any code on validate events it will be called automatically when you do a regular submit. You would put all of that validate code into a single script or func
tion and call it from the button click event.
Hope that helps
Paul
I tried that. I can skip my own validation functions but I still need to skip "nullTest" validation too.
Here is an XML excerpt from one of the fields:
<validate nullTest="error">
<message>
<text name="scriptTest">Field X is required</text>
<text name="formatTest">- Form Details-</text>
</message>
<script contentType="application/x-javascript">
//run my validation function here if skipValidationFlag is off
</script>
</validate>
I figured I can change nullTest to "disabled" using javascript. So when my submit button is pressed I have to do this for every single field : !!!
field.validate.nullTest = "disabled";
then set them back to "error" so the normal submit button with validation would work.
So now my question is, how can I loop over all fields that have nullTest="error" ? can I keep track of them in an array?
Views
Replies
Total Likes
I have a sample that shows how to get back each field on a form ....I use it to lock each field but you can do whatever you want with it.
The code is in a function on this form and the function wil lock all fields in a subform that is passed to the function.
Paul
The function is very helpful, thx.
I just have an issue accessing validate object under the field elements. I can lock all fields using you LockAllFields() I added the following into the loop script:
allChildElements.item(j).validate.nullTest = "disabled";
In Acrobat's debuger I get an error saying "allChildElements.item(j).validate is undefined". Evey Node must have a validate object as far as I know. Aren't allChildElements.item(j) nodes?
Views
Replies
Total Likes
The allChileElements will give you everything under that node (fields, subforms, draws, etc....) Some of those objects do not have a validate property. Thats why there is a further qualification where we are grabbing objects with a specific className of subform or field. If it is a subform then we need to dig deeper into that structure, if it is a field then we can set the validation.
Make sense?
paul
Views
Replies
Total Likes
I discovered it (in a hardway). I ended up using try { ...}catch(e){}
Now I can disable nulltest for most fields. I say most fields because there could be multiple instances of some fields (in dynamicly generated fields) so I may have 3 previousJobTitle fields. User can add more as needed. Our function does not seem to capture those repatable fields.
looking into the reference I am trying to do something like the following the function reaches a subform:
currentSubformFieldsNodes = currentElement.resolveNodes("#fields[*]");
Views
Replies
Total Likes
Thx Pual, I solved it using your function.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies