# Help me system.gui.confirm

**URL:** <https://forum.inductiveautomation.com/t/help-me-system-gui-confirm/21238>\
**Category:** Ignition\
**Created:** [December 5, 2018, 4:59pm UTC](https://forum.inductiveautomation.com/t/help-me-system-gui-confirm/21238 "2018-12-05T16:59:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mavallejo](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@mavallejo](https://forum.inductiveautomation.com/u/mavallejo)\
**Post date:** [December 5, 2018, 4:59pm UTC](https://forum.inductiveautomation.com/t/help-me-system-gui-confirm/21238/1 "2018-12-05T16:59:36Z")

</div>

Hello Team,

I’m starting use Ignition system but I don’t know how to configure a button with a question without skip question.

I have this code

if system.gui.confirm(u’Are you sure?’, ‘Confirm’):

np = event.source.parent.getComponent(‘PartNumber’).text  
e = event.source.parent.getComponent(‘Estacion’).selectedStringValue  
de = event.source.parent.getComponent(‘Descripcion’).text  
tp = event.source.parent.getComponent(‘TipoSurtido’).selectedStringValue  
m = event.source.parent.getComponent(‘Monitor’).selectedStringValue  
pdd = event.source.parent.getComponent(‘PDD’).text  
pdm = event.source.parent.getComponent(‘PDM’).text

system.db.runPrepUpdate(“Insert Into [dbo].[masterdata] (Numero\_Parte\_Sap,Estacion,Descripcion,Tipo\_Surtido,Monitor,PDD,PDM) values (?,?,?,?,?,?,?)”,[np,e,de,tp,m,pdd,pdm])  
system.gui.messageBox(“Masterdata item Added”)  
system.db.refresh(event.source.parent.getComponent(‘Table’),“data”)

but when I press the button, show me a pop up but if I press YES insert the record a is all fine, but if I press No  
also insert the record in database and I don’t want that.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 5, 2018, 5:01pm UTC](https://forum.inductiveautomation.com/t/help-me-system-gui-confirm/21238/2 "2018-12-05T17:01:24Z")

</div>

Your formatting was lost when pasted into the forum, but is all of your code indented to follow the if statement? Like this:

```auto
if system.gui.confirm(u'Are you sure?', 'Confirm'):
	np = event.source.parent.getComponent('PartNumber').text
	e = event.source.parent.getComponent('Estacion').selectedStringValue
	de = event.source.parent.getComponent('Descripcion').text 
	tp = event.source.parent.getComponent('TipoSurtido').selectedStringValue
	m = event.source.parent.getComponent('Monitor').selectedStringValue
	pdd = event.source.parent.getComponent('PDD').text
	pdm = event.source.parent.getComponent('PDM').text

	system.db.runPrepUpdate("Insert Into [dbo].masterdata values (?,?,?,?,?,?,?)",[np,e,de,tp,m,pdd,pdm])
	system.gui.messageBox("Masterdata item Added") 
	system.db.refresh(event.source.parent.getComponent('Table'),"data")

```

---

<div class="post-metadata">

**Author:** ![mavallejo](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@mavallejo](https://forum.inductiveautomation.com/u/mavallejo)\
**Post date:** [December 5, 2018, 5:14pm UTC](https://forum.inductiveautomation.com/t/help-me-system-gui-confirm/21238/3 "2018-12-05T17:14:36Z")

</div>

Thanks my friend, Appreciate your support
