Form bulider changing the html result of a user defined tag

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
julesb
New Member
New Member
Posts: 3
Joined: Thu Feb 12, 2009 3:32 pm

Form bulider changing the html result of a user defined tag

Post by julesb »

Hi

Got a real puzzle and it has got me totally foxed.

CMS Version 1.5.2
FormBuilder 0.5.10
PHP version 4.4.9

I am using a user defined tag in the form template to display the form elements with labels, required, errors etc.

Part of the form template

       {formField entry="$OrderNO"}
        {formField entry="$name"}

here is the user defined tag

======================================================
$entry = $params['entry'];
if(isset($params['labelRight'])){
    $labelRight = true;
}
else{
    $labelRight = false;
}
$result = "";
if($entry->display == 1){
    if($entry->needs_div == 1){
        $result .= 'required == 1 or $entry->css_class != '' or $entry->valid == 0){
            $result .= ' class="';
            if($entry->required == 1) $result .= 'required';
            if($entry->css_class != '') $result .= ' '.$entry->css_class;
            if($entry->valid == 0)  $result .= ' fb_invalid';
            $result .= '"';
        }
        $result .= '>';
    }
    if($entry->hide_name == 0 and !$labelRight){
        $result .= 'multiple_parts != 1){
$result .= 'for="'.$entry->input_id. '"';
}
$result .= '>'. $entry->name;
        if($entry->required_symbol != ''){
            $result .= ' '. $entry->required_symbol;
        }
        $result .= '';
    }
    if($entry->multiple_parts == 1){
        foreach($entry->input as $key => $value){
            if($entry->label_parts == 1){
                $result .= ''. $entry->input[$key]->input. ' '. $entry->input[$key]->name. '';
            }
            else{
                $result .= $entry->input[$key]->input;
            }
            if(isset($entry->input[$key]->op) and $entry->input[$key]->op) $result .= $entry->input[$key]->op;
        }
    }
    if($entry->smarty_eval == '1'){
$result .= eval($entry->input);
}
else{
$result .= $entry->input;
}
    if($entry->hide_name == 0 and $labelRight){
        $result .= 'multiple_parts != 1){
$result .= 'for="'.$entry->input_id. '"';
}
$result .= '>'. $entry->name;
        if($entry->required_symbol != ''){
            $result .= ' '. $entry->required_symbol;
        }
        $result .= '';
    }
    if($entry->valid == 0) $result .= '<--- '. $entry->error;
    if($entry->needs_div == 1){
        $result .= '';
    }
echo $result;
===============================================

the result should be:
Purchase Order No:
        Your Name: *


Here is what I get

Purchase Order No:

        Your Name: *


As you can see the label tags have been broken and the actual inpu element placed inside the broken label tags.

I have tried changing the code in the tag to see if there was a clash and something else was executing, but this does not seem to be the case.

If anybody can help I would be incredibly grateful.

Jules
julesb
New Member
New Member
Posts: 3
Joined: Thu Feb 12, 2009 3:32 pm

Re: Form bulider changing the html result of a user defined tag

Post by julesb »

Just figured it out, no space between label and for in the label tag, but why the strange re-write I havn't got a clue  ???
Post Reply

Return to “Modules/Add-Ons”