Hi ther,
Ive been away from Livecucle for a while and have lost a handle on the coding.
I'm tyring to get the data from one filed to also be repeated in two other fields with different formatting (uppercase and capatilise each word)
So if user enters "james michael smith" into a filed named - say - fullanme - it would also be reproduced in a file fullnameCaps - changed to all caps in that feild (i.e as JAMES MICHAEL SMITH) and - fullnameCapsEach filed would come out James Michael Smith
the other fields will just be hidden.
I remembered hot to change input to caps in the input field - xfa.event.change = xfa.event.change.toUpperCase() - but that only works in the input field of course.
i tried setting the fullnameCaps and fullnameCapsEach to equal the rawvalue of the input fullanme field and putting the change code in them - but that doesnt seem to be the answer!
Anyone out there got nay ideas ?
cheers
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
try this solution in the change event of your input field:
var str = xfa.event.newText, capsAll, capsFirst;
capsAll = str.toUpperCase();
capsFirst = str.toLowerCase().replace(/([^a-z]|^)([a-z])(?=[a-z]{1})/g, function(_, g1, g2) {
return g1 + g2.toUpperCase();
});
fullnameCaps.rawValue = capsAll;
fullnameCapsEach.rawValue = capsFirst;
Views
Replies
Total Likes
Hi,
try this solution in the change event of your input field:
var str = xfa.event.newText, capsAll, capsFirst;
capsAll = str.toUpperCase();
capsFirst = str.toLowerCase().replace(/([^a-z]|^)([a-z])(?=[a-z]{1})/g, function(_, g1, g2) {
return g1 + g2.toUpperCase();
});
fullnameCaps.rawValue = capsAll;
fullnameCapsEach.rawValue = capsFirst;
Views
Replies
Total Likes
Hi radzmar
thanks for the suggestion - i'll give that a go.
Views
Replies
Total Likes
works perfectly - thank you
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies