Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2007
    Location
    Chepstow, SE Wales
    Posts
    101
    Plugin Contributions
    0

    Default text field area on step 1 of 3 page

    I need to make that text are field on step 1 of 3 page mandatory, and i also need to add some shadow text in there to describe what I need from the customer.

    I think I tracked the function down to html_output.php page, and this function below, but not too sure:
    PHP Code:
    // Output a form textarea field
      
    function zen_draw_textarea_field($name$wrap$width$height$text ''$parameters ''$reinsert_value true) {
        
    $field '<textarea name="' zen_output_string($name) . '" wrap="' zen_output_string($wrap) . '" cols="' zen_output_string($width) . '" rows="' zen_output_string($height) . '"';

        if (
    zen_not_null($parameters)) $field .= ' ' $parameters;

        
    $field .= '>';

        if ( (isset(
    $GLOBALS[$name])) && ($reinsert_value == true) ) {
          
    $field .= stripslashes($GLOBALS[$name]);
        } elseif (
    zen_not_null($text)) {
          
    $field .= $text;
        }

        
    $field .= '</textarea>';

        return 
    $field;
      } 
    could somebody help me with this.

    Thanks

    Lee
    Are we there yet?

    Just one more line of code and im done...

  2. #2
    Join Date
    Sep 2007
    Location
    Chepstow, SE Wales
    Posts
    101
    Plugin Contributions
    0

    Default Re: text field area on step 1 of 3 page

    Sorry, I just dont know why I targeted that function when its obviously the wrong one.

    But still Im trying to make that text field mandatory, and I need some shadow text inside the textfield to prompt the customer.

    With it being mandatory, it needs to alert the customer if no text is entered.

    Any ideas anybody

    Lee
    Are we there yet?

    Just one more line of code and im done...

  3. #3
    Join Date
    Sep 2007
    Location
    Chepstow, SE Wales
    Posts
    101
    Plugin Contributions
    0

    Default Re: text field area on step 1 of 3 page

    This is the code that calls the function for the textarea and its in this folder:
    includes/templates/classic/templates/tpl_checkout_payment_default.php

    PHP Code:
    <fieldset>
    <legend><?php echo TABLE_HEADING_COMMENTS?></legend>
    <?php echo zen_draw_textarea_field('comments''45''3'); ?>
    </fieldset>
    Would love some assistance.

    Cheers

    Lee
    Are we there yet?

    Just one more line of code and im done...

  4. #4
    Join Date
    Sep 2007
    Location
    Chepstow, SE Wales
    Posts
    101
    Plugin Contributions
    0

    Default Re: text field area on step 1 of 3 page

    Ok i think ive nearly got to the bottom of it, but im inches off i reckon.

    Ive found out where the javascript validation takes place to make sure the form is fille din correctly, and using the code below from the tpl_checkout_payment_default.php page:

    PHP Code:
    <fieldset>
    <legend><?php echo TABLE_HEADING_COMMENTS?></legend>
    <?php echo zen_draw_textarea_field('comments''45''3'); ?>
    </fieldset>
    The validation code is on the page payment.php page, and I put the text field validation code inside below:

    PHP Code:
    function javascript_validation() {
        
    $js '';
        if (
    is_array($this->modules) && sizeof($this->selection()) > 0) {
          
    $js '<script language="javascript"  type="text/javascript"><!-- ' "\n" .
          
    'function check_form() {' "\n" .
          
    '  var error = 0;' "\n" .
          
    '  var error_message = "' JS_ERROR '";' "\n" .
          
    '  var payment_value = null;' "\n" .
          
          
    '  if (document.checkout_payment.comments == "" ) {' "\n" .
          
    '  error_message = error_message + "' JS_ERROR_NO_TEXT_ENTERED '";' "\n" .
          
    '  alert(error_message);' "\n" .
          
    '  }' "\n" 
          
          
    '  if (document.checkout_payment.payment) {' "\n" .
          
    '    if (document.checkout_payment.payment.length) {' "\n" .
          
    '      for (var i=0; i<document.checkout_payment.payment.length; i++) {' "\n" .
          
    '        if (document.checkout_payment.payment[i].checked) {' "\n" .
          
    '          payment_value = document.checkout_payment.payment[i].value;' "\n" .
          
    '        }' "\n" .
          
    '      }' "\n" .
          
    '    } else if (document.checkout_payment.payment.checked) {' "\n" .
          
    '      payment_value = document.checkout_payment.payment.value;' "\n" .
          
    '    } else if (document.checkout_payment.payment.value) {' "\n" .
          
    '      payment_value = document.checkout_payment.payment.value;' "\n" .
          
    '    }' "\n" .
          
    '  }' "\n\n"
    The extra spaced 'if statement' not from the top is my addition, and i think its not looking at the right thing to validate it. My reason for thinking this, is that I took away the if bit and just had the error calling that error description and it worked.

    But when i click submit, its not seeing that the field 'comments' has nothing typed into it and bypassing the if statement.

    can anybody see my problem.

    Lee
    Are we there yet?

    Just one more line of code and im done...

  5. #5
    Join Date
    Sep 2007
    Location
    Chepstow, SE Wales
    Posts
    101
    Plugin Contributions
    0

    Default Re: text field area on step 1 of 3 page

    Ok this seems to work:

    PHP Code:
    '  if (document.checkout_payment.comments.value == "" ) {' "\n" .
          
    '  error_message = error_message + "' JS_ERROR_NO_TEXT_ENTERED '";' "\n" .
          
    '  alert(error_message);' "\n" .
          
    '  }' "\n" 
    I was missing .value on the end

    Just an order of alert issue now.

    If anybody still feels they can contribute then I would be pleased to talk to you.

    Lee
    Are we there yet?

    Just one more line of code and im done...

  6. #6
    Join Date
    Sep 2007
    Posts
    18
    Plugin Contributions
    0

    Default Re: text field area on step 1 of 3 page

    Thanks multichild!

    this was exactly what I was looking for, just had to add "return false" at the end to keep it from advancing.

    really appreciate the post

 

 

Similar Threads

  1. Odd text on step 1 of 3 delivery information page
    By empiregamestore in forum General Questions
    Replies: 3
    Last Post: 2 May 2014, 07:55 AM
  2. Add text area for Featured Products on home page
    By barendfaber in forum General Questions
    Replies: 4
    Last Post: 23 Oct 2013, 11:31 PM
  3. text size problem on ONE PAGE ONLY - step 2 of checkout
    By marvin in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 12 Jul 2010, 10:26 AM
  4. Adding a Text Area to the Product Info Page
    By innovafire in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 2 Jan 2008, 04:40 AM
  5. background color for text area main page...?
    By wasana in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 13 Jul 2007, 04:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR