| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Make Custom Text Field Required??? | ||||
![]() |
|
|
Thread Tools | Search this Thread |
#11
|
|||||||
|
|||||||
![]() Robert
Reading your question above & other forum members' advice helped me solve a problem I had with a client's site: to collect more detail about hamper delivery requirements for a holiday cottage. I copied your solution of using a custom field and validating it to ensure it's not empty. In solving my problem, I think I have a useful lead on yours. The code I used to make sure the input boxes are not completely empty is the following javascript: <snippet> if (document.getElementById('po1').value.length < 1) { alert('Please specify your Arrival Date'); return false; } if (document.getElementById('po2').value.length < 1) { alert('Please specify the Cottage Name'); return false; } else return true; </snippet> To be clear, you'll want to change the 'po' numbers to 'po9' and 'po8' respectively, and change the alert message to something like 'Please insert Date' and 'Please insert Client Name' as appropriate. I probably wouldn't choose to add round brackets _within_ the Alert itself [e.g. Client(s) Name] - call it cowardice on my part! It'd likely be OK but it's only an alert after all. Who needs excellent grammar at that point? PM me if that isn't clear enough for you to know how to alter & insert it for your site. John
__________________
Two client sites: 4.4.4 and 4.5.5 Coding since 1981. Using X-Cart since 2012 |
|||||||
#12
|
|||||||
|
|||||||
![]() Quote:
I was able to use your code (with the needed adjustments) and finally get the validation to work on each of the products where I use the text input fields. Thank you very very much. |
|||||||
#13
|
|||||||
|
|||||||
![]() Robert
That's excellent news. Glad to be able to help Cheers, John
__________________
Two client sites: 4.4.4 and 4.5.5 Coding since 1981. Using X-Cart since 2012 |
|||||||
|
|||
X-Cart forums © 2001-2020
|