R2i DotNetNuke® Forum

R2i wants you to have the opportunity to ask questions, post reviews, help others or just rant and rave about DotNetNuke® or any of the R2i Modules and Skins. Our team spends hour upon hour, day after day, working on custom DotNetNuke® modules and services; please feel free to ask us anything.
 
page_smartvalidation
Last Post 11 Mar 2009 05:58 PM by svedire. 1 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Informative
jwmottUser is Offline
New Member
New Member
Posts:62

--
28 Jan 2009 06:18 PM  
I have enclosed an image of an input screen to help describe my issue.

The form I have is used to record attendance for a classroom. The form is populated based on a classrooms current enrollment. The form needs to have the following rules applied:

If student is marked absent then hours attended must equal 0 (zero), and the form must not accept an arrived late reason or a left early reason.

If student is not marked absent and not marked as arriving late or leaving early then the maximum allowed and default hours atttended is 5.5.

If student is marked either late or leaving early then an absent reason cannot be selected, and the maximum value of hours attended is 5.49.

The form is currently setup with each element for each student (hours, absentReason, lateReason, EarlyReason, etc) named and identified with id='hours[clientid]' name='hours[clientid]' and so on. I need to validate the number of hours to be either 0 (zero), less than or equal to 5.5 or less than or equal to 5.49 depending on the status of the absent reason, late reason and early reason controls on the form.

I would prefer to use page_smartvalidate or emulate its summary area at the top of the form so that the user experience is consistent.

Am I making any sense as to what I need and does anyone have any good ideas as to how I should accomplish my goal? I have been working on this for several days now and have tried various custom javascripts but I just can't seem to get my head around this.

I am beginning to think that page_smartvalidate is not going to work and I am going to have to write my own custom javascript validation routine.


Attachment: attend1.png

svedireUser is Offline
Basic Member
Basic Member
Posts:128

--
11 Mar 2009 05:58 PM  
Hi,

Try doing it the following way.

The range field validator can be used to check the values

Here is an example:

<input type="text" name="ptest" id="ptest" />
<span id="vptest"
controltovalidate="ptest"
errormessage="test"
display="Dynamic"
group="testing"
evaluationfunction="RangeValidatorEvaluateIsValid"
MinimumValue="1" MaximumValue="10" Type="Float"
initialvalue="" style="color:Red;display:none;">Not in range</span>
<a href="#" onclick="if (typeof(Page_SmartValidate) == 'function') if(Page_SmartValidate('testing')) \{ alert('test');\}return false;">Test</a>

I set the Type in the validator to float and it takes values only in the range of 1 to 10.

Hope this helps.

Thanks,
Sindura
R2integrated


You are not authorized to post a reply.

Active Forums 4.1
 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seatle, WA • 410.327.0007 • info@R2Integrated.com

Bookmark & Share Bookmark and Share