Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JScript from zen cart package

Status
Not open for further replies.

abovetopsecret

Programmer
Jan 16, 2008
61
0
0
GB
I am in the process of putting together an ecommerce site for my clients using zen cart.

I wanted to make a text field mandatory and have managed to adapt the code with a few changes all round the folders, to get this working. But all I need to do is when an alert pops up and it has 2 errors in it, that the one below moves underneath it, not on the same line.

And its this where I need the help, the code is below but i dont know where or hot to put teh line break in to get this working.

Code:
$js .= "\n" . '  if (payment_value == null && submitter != 1) {' . "\n" .
      '    error_message = error_message + "' . JS_ERROR_NO_PAYMENT_MODULE_SELECTED . '";' . "\n" .
      '    error = 1;' . "\n" .
      '  }' . "\n\n" .
	  '  if (document.checkout_payment.comments.value == "" && submitter != 1) {' . "\n" .
	  '  error_message = error_message + "' . JS_ERROR_NO_TEXT_ENTERED . '";' . "\n" .
	  '  error = 1;' . "\n" .
	  '  }' . "\n" .
      '  if (error == 1 && submitter != 1) {' . "\n" .
      '    alert(error_message);' . "\n" .
      '    return false;' . "\n" .
      '  } else {' . "\n" .
      '    return true;' . "\n" .
      '  }' . "\n" .
      '}' . "\n" .
      '//--></script>' . "\n";

as you can see there are 2 error messages in there, on their own they are fine, but when they both appear they stay on the same line.

Cheers
 
So, the problem is with the PHP and not the Javascript, but you posted your question in the Javascript forum?

Lee
 
Isnt the code above java script.

I managed to adapt that code to get it workign, so just thought that the problem lay there and that it was a java script issue.
 
I see a bunch of PHP code you posted. If you want help with a Javascript problem, show us the final output from the client side. Your description sounds like a problem with how the PHP is writing the Javascript, or you're not putting a '\n' in your JS where you want a line break.

Lee
 
ok thanks, will look into some more and see if i can sort it out.
 
Ye thanks trollacious,

I was looking into where I needed to put the extra line break.

I have tried and not got it yet, but am looking into it.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top