rachwilbraham Posted March 13, 2009 Share Posted March 13, 2009 Hello! We are using a cookie (written in javascript and url encoded and decoded) to store form variables so that when the page is reloaded we can keep the form variables. We are having a problem with the email address field - the cookie only returns the email address up to the @ symbol and we have narrowed it down to the regexp function.... ??? if (func == 'read') { if (thisCookie != '') { var myregexp = new RegExp(nameQuery + '([\\w]*)'); var match = myregexp.exec(thisCookie); if (match != null && match.length > 1 && match[1] != '') { return match[1]; } } return null; } } Can anyone help?! Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Psycho Posted March 13, 2009 Share Posted March 13, 2009 I have no idea why you would want to save form field values to cookies. If you have a form I would expect that you are using some type of server-side code (such as PHP) to process the form. It is much more efficient to repopulate the form on the server-side (using POST variables) than in JavaScript. But you can allow the at symbol by simply adding it to the regex expression var myregexp = new RegExp(nameQuery + '([\\w@]*)'); Quote Link to comment Share on other sites More sharing options...
rachwilbraham Posted March 13, 2009 Author Share Posted March 13, 2009 OMG we can't believe its actually that simple!!! You wouldn't believe it but me n the boss have been trying to figure that out all day!!!! (we're in england....its nearly going home time!) Thank you so so so so so so much!!!! Our saviour!!! Lol! Quote Link to comment Share on other sites More sharing options...
Psycho Posted March 13, 2009 Share Posted March 13, 2009 Please mark the topic as solved. 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.