TWIRED Posted December 7, 2016 Report Share Posted December 7, 2016 HI I have a field in a submission form called "Website URL" It is validated with some javascript in the footer. If it has an error message I need to either a) modify the default "required" error message underneath the field or b ) have the error message show up on the top of the page in a label. ANy help would be pretty , pretty , pretty cool Quote Link to comment Share on other sites More sharing options...
MayMusic Posted December 23, 2016 Report Share Posted December 23, 2016 So if it is not validated you can add an alert in the function to show link is not valid like: alert('Enter a valid URL'); Quote Link to comment Share on other sites More sharing options...
MayMusic Posted December 23, 2016 Report Share Posted December 23, 2016 Oh you can add HTML Block right above or next to the field and then add div to it <div id='mymsg'></div> In the function where you conform the link add the following to the else statement: If not correct link: document.getElementById('mymsg').innserHTML = '<b>This link is not valid</b>'; Quote Link to comment Share on other sites More sharing options...
TWIRED Posted February 4, 2017 Author Report Share Posted February 4, 2017 What I was looking to do was : change the value of a label (of a particular element) in a form. figured it out. Thanks ! Qtn : Using Javascript, is it possible to change the value of a >> Virtual Field ? If so, How ???? solution to change the value of a label of a particular element in a form: ------------------------------------------------------------------------------------------------------------ var labels = document.getElementsByTagName('label'); // 'label' is passed as the argument. To get this argument, First inspect the form element TYPE name in Chrome. for (var i = 0; i < labels.length; i++) { if (labels.htmlFor != '') { var elem = document.getElementById(labels.htmlFor); if (elem) elem.label = labels; } } document.getElementById('EditRecordDummyCount').label.innerHTML = 'Label text is changed'; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.