javascript - Client-side validation when changing input ids in asp.net mvc -


i'm working on form can contain multiple instances of sub-form. main entry 'publication form' contains multiple instances of sub-page 'publication.' i'm doing using ajax, , every time user clicks 'add row' button, new sub-form item, called custom view.

now, every time 'add row' button clicked, javascript counter incremented, , value sent controller, puts viewbag, , sends view file. each item treated differently, use viewbag counter increment it's name , id, example:

<input id="pubdetails@(viewbag.upto)" class="text-box single-line" type="text" value="" name="pubdetails@(viewbag.upto)" data-val-required="the full publication details (include isbn, web addresses etc) (include authors) field required." data-val="true"> <span class="field-validation-valid" data-valmsg-replace="true" data-valmsg-for="pubdetails@(viewbag.upto)"></span> 

this view file not part of it's own form, rather fields being passed form of master page.

the issue now, client side validation doesn't work these fields, i've changed ids! there way specify ids kind of validation, outside of default? maybe like

<input validationid="pubdetails"> 

or way of re-pointing validation @ appropriate field ids?

thanks!

since you're not using ajax.beginform(), i'm pretty sure need use $.validator.unobtrusive.parse("#id); specify there's validator information want parsed.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -