Link to home
Start Free TrialLog in
Avatar of Amanda Watson
Amanda WatsonFlag for Australia

asked on

How can I make this field pre - selected?

Hi There, On this site here
http://www.smokinhot.com.au/Go-through-checkout-process?redirected=1

If you select new user - you will see there is a user field that has NEWSLETTER - How can I make this preselected?

There isn't an option in the user field managment?

Thanks,
Avatar of austega
austega
Flag of Australia image

Mmm... I am redirected to http://www.smokinhot.com.au/View-your-cart-content when I click on your link - and cannot see a New User link/button.


In any case what extension etc are you using to gather the new user info including newsletter option?
Avatar of Amanda Watson

ASKER

No extension, its just virtuemars user fields
just go to the shop add some items to your cart and proceed to checkout to see the new user section where you will see the newsletter field...i want it pre-selected
Avatar of Mark Brady
Do you mean the check box next to "Newsletter? If you want that checked by default just add the word "checked" to it.


Here is a sample.

<input type="checkbox" name="sample" checked />

The word checked will put a checkmark in the box.
Where would I do this though?
This is dynamically generated somehow...?
ASKER CERTIFIED SOLUTION
Avatar of Mark Brady
Mark Brady
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Mmm... good question. I agree there doesn't seem to be any ability to use VM user field parameters - I would expect someone has documented a work around on the VM forums.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Might be a better idea to place the above code in this file instead as it already has a mootools function and it comes after the loading the mootools-release-1.11.js
http://www.smokinhot.com.au/components/com_virtuemart/js/mootools/mooPrompt.js

Cheers!
Hi, just checking remorina, but that code here:
window.addEvent('domready', function() {
if ($('vm_newsletter_field')) {
$('vm_newsletter_field').checked=true;}
});

addded to http://www.smokinhot.com.au/components/com_virtuemart/js/mootools/mooPrompt.js

Is all i need to do to make that work?

Is that the correct field name...?  
did you try my suggestion yet? All you need to do is drop that javascript function into the page and change the id to the id of the checkbox and it will check the box when the page is loaded. Pretty simple to do!
@snowball77:
Yes, it should suffice to make it checked and the checkbox name is "vm_newsletter_field" as used in the code.

I've tested direct execution and it and it worked but you will need to try it yourself and see if it sucessfully executes or causes any errors, hopefully it shouldn't.

And the file mooPrompt.jos you pointed is the correct file you should place the block in, just make sure you add it at the bottom of the file after all other functions.

Cheers!
remorina..that worked thanks.
elvin I am sure yours would work too I just took the easiet option here!
Thank you
eww slight problem, this pre selected trick doesn't seem to be working in IE???
Looks like elvin66 solution worked for all browsers....
Sorry I need to change the point allocation
Thanks Snowball. I knew it would work as I have used it myself but I'm glad you got it working.
Ta