<a href="http://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_form_alter/7">http://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_form_alter/7</a> -- the hook takes $form as an argument passed by reference.. so all the changes you make in $form, it should get reflected in the UI.. Please share your code if it does not work for you..<br>
<br><div class="gmail_quote">On Mon, Feb 20, 2012 at 8:57 PM, Athanasios Velios <span dir="ltr">&lt;<a href="mailto:a.velios@gmail.com">a.velios@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hm, I commented the lines in template.php and built a new module with the hook_form_alter and additional logic but this does not make any difference at all. Exactly the same behaviour...<br>
<br>
Thanasis<div class="im"><br>
<br>
On 20/02/12 09:25, Mukesh Agarwal wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Yes, Drupal is quite structured and has defined ways to deal with<br>
stuff.. template.php and hook_form_alter are for 2 different purposes<br>
and in your case writing a custom module which implements the hook is<br>
the right way.<br>
<br>
On Mon, Feb 20, 2012 at 2:53 PM, Athanasios Velios &lt;<a href="mailto:a.velios@gmail.com" target="_blank">a.velios@gmail.com</a><br></div><div class="im">
&lt;mailto:<a href="mailto:a.velios@gmail.com" target="_blank">a.velios@gmail.com</a>&gt;&gt; wrote:<br>
<br>
    Do you reckon that the problem is putting the code in template.php<br>
    instead of a custom module?<br>
<br>
    Thanks again,<br>
<br>
    Thanasis<br>
<br>
<br>
    On 20/02/12 08:27, Mukesh Agarwal wrote:<br>
<br>
        The place to implement logic based form_set_error should be in the<br>
        validate function and not template.php .. I would recommend you use<br>
        hook_form_alter<br></div>
        &lt;<a href="http://api.drupal.org/api/__drupal/modules%21system%__21system.api.php/function/__hook_form_alter/7" target="_blank">http://api.drupal.org/api/__<u></u>drupal/modules%21system%__<u></u>21system.api.php/function/__<u></u>hook_form_alter/7</a><div class="im">
<br>
        &lt;<a href="http://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_form_alter/7" target="_blank">http://api.drupal.org/api/<u></u>drupal/modules%21system%<u></u>21system.api.php/function/<u></u>hook_form_alter/7</a>&gt;&gt;<br>

<br>
        -&gt; $form_id will indicate the form you wish to alter, and there<br>
        you can<br>
        add a custom validate function in $form[&#39;#validate&#39;] -- the custom<br>
        function should then take care of form_set_error<br>
<br></div>
        <a href="http://api.drupal.org/api/__drupal/includes%21form.inc/__function/form_set_error/7" target="_blank">http://api.drupal.org/api/__<u></u>drupal/includes%21form.inc/__<u></u>function/form_set_error/7</a><div class="im">
<br>
        &lt;<a href="http://api.drupal.org/api/drupal/includes%21form.inc/function/form_set_error/7" target="_blank">http://api.drupal.org/api/<u></u>drupal/includes%21form.inc/<u></u>function/form_set_error/7</a>&gt;<br>

        -- you need to set the element name as first parameter to make<br>
        sure that<br>
        the particular field is highlighted.<br>
<br>
        On Mon, Feb 20, 2012 at 1:51 PM, Athanasios Velios<br>
        &lt;<a href="mailto:a.velios@gmail.com" target="_blank">a.velios@gmail.com</a> &lt;mailto:<a href="mailto:a.velios@gmail.com" target="_blank">a.velios@gmail.com</a>&gt;<br></div><div><div class="h5">
        &lt;mailto:<a href="mailto:a.velios@gmail.com" target="_blank">a.velios@gmail.com</a> &lt;mailto:<a href="mailto:a.velios@gmail.com" target="_blank">a.velios@gmail.com</a>&gt;&gt;&gt; wrote:<br>
<br>
            Hello,<br>
<br>
            I am trying to alter a form (uc_cart_view_form) with various<br>
        input<br>
            fields (Qty for products). In template.php I am adding some<br>
        extra<br>
            logic which applies across a selection of these fields. Once the<br>
            logic is checked I need to display an error message. I am using<br>
            form_set_error to show the message. The problem is that the user<br>
            then updates the input values and updates the form, but the new<br>
            figures are not taken into account. They are shown in the<br>
        form, but<br>
            not used in my template.php extra logic.<br>
<br>
            drupal_set_message allows the new values to work but the message<br>
            appears twice and it does not, obviously, link to specific<br>
        fields in<br>
            the form which are problematic.<br>
<br>
            Setting form_state rebuild to true before form_set_error<br>
        does not<br>
            have an effect.<br>
<br>
            Any ideas of what needs to be done for these values to be<br>
        taken into<br>
            account with form_set_error?<br>
<br>
            Thanks<br>
<br>
            Thanasis<br>
<br>
<br>
<br>
<br>
        --<br>
        Cheers,<br>
        Mukesh Agarwal<br></div></div>
        ______________________________<u></u>____<div class="im"><br>
        Innoraft Solutions &lt;<a href="http://www.innoraft.com" target="_blank">http://www.innoraft.com</a>&gt;  || +91 8017220799<br>
<br>
<br>
<br>
<br>
--<br>
Cheers,<br>
Mukesh Agarwal<br>
______________________________<u></u>__<br></div>
Innoraft Solutions &lt;<a href="http://www.innoraft.com" target="_blank">http://www.innoraft.com</a>&gt;  || +91 8017220799<br>
<br>
</blockquote>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Cheers,<div>Mukesh Agarwal</div><div>________________________________</div><div><font color="#999999"><a href="http://www.innoraft.com" target="_blank">Innoraft Solutions</a>  || </font><span style="color:rgb(153,153,153)">+91 8017220799</span></div>
<br>