Jeff VIP
Total posts: 745
12 Oct 2015 04:10

Hi,

I have a form that only show a percentage of all fields during submission. Once a record is approved, the remaining fields become available during edit.

The form has currently 3 buttons enabled: Apply, Save and exit and Cancel. After hitting the apply button all fields become visible, which I don't want.

How can I hide the Apply button during submission?

Best regards, Jeff

Last Modified: 14 Oct 2015


pepperstreet VIP
Total posts: 3,837
12 Oct 2015 07:51

Hello Jeff, there is a special parameters group in your submission-form template. See here:
YourType -> General Parameters -> Templates -> Submission Form (click edit button)

mj_cob_type_submission_form_buttons


pepperstreet VIP
Total posts: 3,837
12 Oct 2015 07:56

Or do you want to distinguish betweeen "new submission" and "edit" };)


Jeff VIP
Total posts: 745
12 Oct 2015 08:45

pepperstreet Or do you want to distinguish betweeen "new submission" and "edit" };)

Yes :-)


pepperstreet VIP
Total posts: 3,837
13 Oct 2015 02:31

Jeff Yes :-)

I knew it... ;)
Can't recall it, but there was a variable that indicates a new item, IMHO. But I could be wrong.


Anyways, you should be able to distinguish the context by the missing/empty record ID. A new submission does not have an ID.

Neither in URL and form

$this->form->getInput('id')

Nor in

$this->item->id

BTW, you can find a suitable IF ELSE example in the default.php form template. See around line 170++.
This is reponsible for the dynamic heading text:

<?php if($this->item->id):?>
    <?php echo JText::sprintf('CTEDIT', $this->escape($this->type->name), $this->item->title); ?>
<?php else: ?>
    <?php echo JText::sprintf('CTSUBMIT', $this->escape($this->type->name)); ?>
<?php endif; ?>

Edit an existing record:
cob_form_heading_edit

Submitting a new record:
cob_form_heading_submit_new

Later on below, the buttons are loaded as a sub_template from form template default.php
So you might have to override that file, check for record ID and load your own button sub_template.
Or override the buttons template directly.

Hope this helps.


Jeff VIP
Total posts: 745
14 Oct 2015 00:09

pepperstreet BTW, you can find a suitable IF ELSE example in the default.php form template. See around line 170++.

Ah, thank you pepperstreet. I used that one in my buttons template override.

+1

Powered by Cobalt