FeedbackForm: creating cancel/reset button

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
lleighh
Forum Members
Forum Members
Posts: 59
Joined: Tue Apr 11, 2006 2:40 pm

FeedbackForm: creating cancel/reset button

Post by lleighh »

I know the FeedbackForm has a default submit button. Is there a way of creating a cancel or reset button on the form page?
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm
Location: the Netherlands

Re: FeedbackForm: creating cancel/reset button

Post by Dee »

Only by adding them manually... you'd have to edit modules/FeedbackForm/classes/Form.class.php (the end of function RenderForm).

Regards,
D
lleighh
Forum Members
Forum Members
Posts: 59
Joined: Tue Apr 11, 2006 2:40 pm

Re: FeedbackForm: creating cancel/reset button

Post by lleighh »

Code: Select all

  function RenderForm($id, &$params, $return_id)
  {
    $module =& $this->mod_globals->selfptr;
    if ($this->FormId == -1)
      {
	echo "<!-- no form -->\n";
	return;
      }
    if ($this->loaded != 'full')
      {
	$this->LoadForm($params);
      }
    $this->thisPage++;
    if ($this->formTotalPages > 1)
      {
	echo "<p>Page ".$this->thisPage." of ".$this->formTotalPages."</p>";
      }
    echo '<div class="feedbackform_hidden">';
    echo $module->CreateInputHidden($id, 'form_id', $this->FormId);
    echo $module->CreateInputHidden($id, 'continue', $this->thisPage);
    if ($this->thisPage == $this->formTotalPages)
      {
	echo $module->CreateInputHidden($id, 'done', 1);
      }
    echo "</div>";
    if ($this->mod_globals->UseCSS)
      {
	echo "<div";
      }
    else
      {
	echo "<table";
      }
    if (strlen($this->CSSClass)>0)
      {
	echo " class=\"".$this->CSSClass."\"";
      }
    echo ">";
    $formPageCount = 1;
    for ($i=0; $i < count($this->Fields); $i++)
      {
	$thisField = $this->Fields[$i];
	if ($thisField->Type == 'PageBreak')
	  {
	    $formPageCount++;
	  }
	//echo 'render: '.$formPageCount . ' ' . $this->thisPage . ' ' . $thisField->Name.'<br>';
	if ($formPageCount != $this->thisPage)
	  {
	    if (is_array($params[$this->Fields[$i]->Alias]))
	      {
		foreach ($params[$this->Fields[$i]->Alias] as $val)
		  {
		    echo $module->CreateInputHidden($id, $this->Fields[$i]->Alias.'[]', htmlspecialchars($val,ENT_QUOTES));
		  }
	      }
	    else
	      {
		echo $module->CreateInputHidden($id, $this->Fields[$i]->Alias, htmlspecialchars($params[$this->Fields[$i]->Alias],ENT_QUOTES));
	      }
	    continue;
	  }
	if ($thisField->DisplayInForm)
	  {
	    if ($this->mod_globals->UseCSS)
	      {
		if (! $thisField->ShowLabel)
		  {
		    if ($thisField->Required)
		      {
			echo "<p class=\"required\">";
		      }
		    else
		      {
			echo "<p>";
		      }
		    echo $thisField->Name;
		    if ($thisField->Required && strlen($this->RequiredFieldSymbol)>0) 
		      {
			echo " ".$this->RequiredFieldSymbol;
		      }
		    echo "</p>";
		  }
		echo $thisField->WriteToPublicForm($id, $params, $return_id);
	      }
	    else
	      {
		if ($this->mod_globals->TitlePosition == 0)
		  {
		    echo "<tr><td align=\"right\" valign=\"top\"";
		  }
		else if ($this->mod_globals->TitlePosition == 1)
		  {
		    echo "<tr><td";
		  }
		if (! $thisField->ShowLabel)
		  {
		    if ($thisField->Required)
		      {
			echo " class=\"required";
			if (isset($thisField->CSSClass) && $thisField->CSSClass != '')
			  {
			    echo ','.$thisField->CSSClass.'"';
			  }
			else
			  {
			    echo '"';
			  }
		      }
		    else if (isset($thisField->CSSClass) && $thisField->CSSClass != '')
		      {
			echo ' class="'.$thisField->CSSClass.'"';
		      }
		    echo ">".$thisField->Name;
		    if ($thisField->Required && strlen($this->RequiredFieldSymbol)>0)
		      {
			echo " ".$this->RequiredFieldSymbol;
		      }
		  }
		else
		  {
		    echo "> ";
		  }
		if ($this->mod_globals->TitlePosition == 0)
		  {
		    echo "</td><td align=\"left\" valign=\"top\">";
		  }
		else if ($this->mod_globals->TitlePosition == 1)
		  {
		    echo "</td></tr><tr><td>";
		  }
		echo $thisField->WriteToPublicForm($id, $params, $return_id);
		echo "</td></tr>\n";
	      }
	  }
	else if ($thisField->Type == 'FunctionCallInput')
	  {
	    echo $thisField->WriteToPublicForm($id, $params, $return_id);
	  }
      }
    if (! $this->mod_globals->UseCSS)
      {
	echo "<tr>";
	if ($this->mod_globals->TitlePosition == 0)
	  {
	    echo "<td> </td><td>";
	  }
	else
	  {
	    echo "<td>";
	  }
      }
    if ($this->thisPage < $formPageCount)
      {
	echo $module->CreateInputSubmit($id, 'submit', $this->NextButtonText,$this->mod_globals->UseIDAndName?'id="'.$this->Alias.'_sub" class="ffsubmit"':'class="ffsubmit"');
      }
    else
      {
	echo $module->CreateInputSubmit($id, 'submit', $this->SubmitButtonText,$this->mod_globals->UseIDAndName?'id="'.$this->Alias.'_sub" class="ffsubmit"':'class="ffsubmit"');
      }
    if ($this->mod_globals->UseCSS)
      {
	echo "</div>\n";
      }
    else
      {
	echo "</td></tr></table>\n";
      }
  }
This is the code. What should be changed in the code? Is there another option beside 'submit'?  Something like CreateInputCancel?
Post Reply

Return to “Modules/Add-Ons”